C-s unix
in the thread list -> failing I-search unix
Here's a thread to post our clever one-liners, miscellaneous hacks, OS rants, configuration files and so on.
Not mandatory but recommended reading: The UNIX-HATERS Handbook https://web.mit.edu/~simsong/www/ugh.pdf
https://www.grymoire.com/Unix/index.html
https://docstore.mik.ua/orelly/unix/upt/index.htm
Some classics:
http://bofh.bjash.com/
http://www.catb.org/~esr/writings/unix-koans/
$ telnet towel.blinkenlights.nl 666
=== The BOFH Excuse Server ===
Someone's tie is caught in the printer, and if anything else gets printed, he'll be in it too.
Connection closed by foreign host.
I like awk
.
>>5
awk
nawk
or gawk
? That's the real question.
>>6
Not him, but gawk.
In Void Linux, /bin
is a symlink to /usr/bin
. While it may seems as an iconoclast move, as we all know that /bin
should only contain the utilities needed in single user mode, further reading on the matter may convince you otherwise. This issue is unrelated to systemd and other distros might follow suit in the future.
https://www.freedesktop.org/wiki/Software/systemd/TheCaseForTheUsrMerge/
http://lists.busybox.net/pipermail/busybox/2010-December/074114.html
When the operating system grew too big to fit on the first RK05 disk pack (their root filesystem) they let it leak into the second one, which is where all the user home directories lived (which is why the mount was called /usr). They replicated all the OS directories under there (/bin, /sbin, /lib, /tmp...) and wrote files to those new directories because their original disk was out of space. When they got a third disk, they mounted it on /home and relocated all the user directories to there so the OS could consume all the space on both disks and grow to THREE WHOLE MEGABYTES
Of course once the split existed, some people made other rules to justify it. Root was for the OS stuff you got from upstream and /usr was for your site-local files. Then / was for the stuff you got from AT&T and /usr was for the stuff that your distro like IBM AIX or Dec Ultrix or SGI Irix added to it, and /usr/local was for your specific installation's files. Then somebody decided /usr/local wasn't a good place to install new packages, so let's add /opt! I'm still waiting for /opt/local to show up...
Void Linux, pros and cons:
pro: http://www.troubleshooters.com/linux/void/whyvoid.htm
contra: http://archive.is/zI5l0
i gotta confess. im terrified of sed and awk and similar wizard shell utilities.
the second i have to do anything more complicated than piping a command into grep or wc, i just write a python script.
>>10
If a bearded Unix admin who's been using sed and awk daily for 30 years tells you that he never has to check something in the man pages, do not believe him. At least you're using Python right, it was only meant to do that.
talk(1)
is fine to discuss with another user on your system, but if you want to broadcast a message to every tty, something always working is:
echo 'hi every1 im new!!!!!!! *holds up spork* my name is katy but u can call me t3h PeNgU1N oF d00m!!!!!!!!' | wall
Broadcast message from katy@supersecretviphackerbox (pts/1) (Fri Apr 24 07:56:31 2020):
hi every1 im new!!!!!!! *holds up spork* my name is katy but u can call me t3h
PeNgU1N oF d00m!!!!!!!!
Awk is really convenient for handling multi-line records. Sometimes I use it only to transform them into single line so that the rest of the tools can handle it.
https://cacm.acm.org/magazines/2016/3/198874-lessons-learned-from-30-years-of-minix/fulltext
Unix V6
https://www.in-ulm.de/~mascheck/various/ancient/
http://www.tom-yam.or.jp/2238/src/
http://gunkies.org/wiki/Installing_Unix_v6_(PDP-11)_on_SIMH
The Lion's book: http://www.lemis.com/grog/Documentation/Lions/
https://olduse.net/
Usenet, updated in real time as it was thirty years ago. Also available in your local news reader via nntp.olduse.net
Ррр
Used this handy command line to split a PDF recently. You don't need an extra tool, Ghostscript does that perfectly.
gs -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -dFirstPage=5 -dLastPage=10 -sOutputFile=output.pdf input.pdf
mfsbsd is a wonderful tool if you want to install FreeBSD on a dedicated server without KVM. Install instructions are never updated on the website or on the FreeBSD wiki though.
Take note of the static ip of the server and the gateway.
% fetch https://download.freebsd.org/ftp/releases/amd64/amd64/ISO-IMAGES/12.1/FreeBSD-12.1-RELEASE-amd64-disc1.iso
# mdconfig -a -t vnode -u 10 -f FreeBSD-12.1-RELEASE-amd64-disc1.iso
# mount_cd9660 /dev/md10 /mnt
% git clone https://github.com/mmatuska/mfsbsd.git
% cd mfsbsd
% cat << EOF > conf.rc.conf
> ifconfig_em0="inet X.X.X netmask 255.255.255.0"
> defaultrouter="X.X.X.X"
> sshd_enable="YES"
> EOF
% make BASE=/mnt/usr/freebsd-dist/
% make CUSTOM=1 BUILDWORLD=1 BUILDKERNEL=1
Boot from the rescue system. In case it doesn't have enough space to upload the mfsbsd image you can dd through ssh.
% dd if=mfsbsd12.1-RELEASE-amd64.img | ssh root@rescue "dd of=/dev/ada0"
That's it, reboot from hard drive. The installer will complain about a missing MANIFEST file.
mkdir -p /usr/freebsd-dist/
touch /usr/freebsd-dist/MANIFEST
bsdinstall
GodWords by Terry A. Davis
#!/bin/bash
#This prints ten random words.
echo "$(shuf -n 10 /usr/share/dict/words --random-source=/dev/urandom | tr '\n' ' ')"
$ ./GodWords
icebergs politicizing nonvirulent Caitlin's Babel croutons guillotined dingbats polygamous gild
Send a mail to your future self.
sendmail anon@mail.org < mail.txt | at 7:00am 11:05:2021
11:05:2021
why?
>>22
current day + 1y?
PIPE LOGIC
Delightfully useless epiphany: Suppose the null-byte is an electron. Then, /dev/zero provides an infinite supply of electrons and /dev/null has an infinite appetite for them. Let's call these devices Vss and Vdd, respectively.
In this model, a UNIX pipe acts like a wire, that is, a conductor with parasitic capacitance. [...]
https://www.linusakesson.net/programming/pipelogic/index.php
A deeper introduction in Unix dc
https://ben165.github.io/unix_dc/index.html
c
20
k
[P1] p
3 600 d n [ ] n / sq
2 400 d n / sw
[
[0 n lt 2 + Q] sk
0 sc
0 sd
0 se
0 st
[
2 lc * ld * la + si
ld 2 ^ lc 2 ^ - lb + d sr sd
li sc
lc 2 ^ ld 2 ^ + d se
4 <k
lt 1 + d st
25 >f
#[ ] n lt n
[1] n lt Q
] sf
lf x
] sj
[
_2 sb
[lj x lb lq + d sb 1 >u] su
lu x
] sE
1 sa
[ [ ] p c lE x la lw - d sa _1<W] sW
lW x
[ ] p
#1.0 sa
#lE x [ ] p c
#0.8 sa
#lE x [ ] p c
#0.6 sa
#lE x [ ] p c
dc -f mandelbrot.dc > mandelbrot.ppm
outputs this image https://ben165.github.io/unix_dc/mandelbrot.gif
In Void Linux, /bin is a symlink to /usr/bin.
every distro i've used makes /bin a symlink to /usr/bin
Upgrade to the plan9 haters handbook.
>>29
Bumped half a year later.
oh whoops
ALL HAIL LISP OS!
https://www.microsoft.com/en-us/research/publication/a-fork-in-the-road/
>>32
This is why lispers are considered inane and schemers are reasonable.
prophile of the UNIX terrorist
http://phrack.org/issues/65/2.html#article
Make your linux distro more inclusive.
$ echo "alias woman=man" >> ~/.bashrc
$ sudo ln -s /usr/share/man/man1/man.1.gz /usr/share/man/man1/woman.1.gz
$ woman woman
>>35
Emacs already has woman: https://www.gnu.org/software/emacs/manual/html_node/woman/index.html
>>36
Is there anything Emacs doesn't have?
>>37
A novice of the temple once approached the Master Programmer with a question: “Master, does Emacs have the Buddha nature?” the novice asked.
The Master Programmer had been in the temple for many years and could be relied upon to know these things. He thought for several minutes before replying: “I don’t see why not. It’s bloody well got everything else.”
>>37
Shame
>>39
There was no need for it.
Member of: NAMBLA
Based
Do you love M4, too??
http://www.cs.stir.ac.uk/~kjt/research/pdf/expl-m4.pdf
https://www.jpeek.com/articles/linuxmag/2005-02/
https://mbreen.com/m4.html
https://elly.town/d/blog/2022-01-05-m4.txt
>>6
MAWK or GAWK.
https://www.gnu.org/software/gawk/
https://linux.die.net/man/1/mawk
>>43
I do not like M4. I hate Perl and I'd rather deal with Perl than deal with M4.