Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Gems from the man page trenches (2016) (saminiir.com)
62 points by LEARAX on Sept 26, 2022 | hide | past | favorite | 25 comments


My favorite man page is scan_ffs.

http://man.openbsd.org/scan_ffs

    The basic operation of this program is as follows:
    
    1.  Panic. You usually do so anyways, so you might as well get it over with. Just don't do anything stupid. Panic away from your machine. Then relax, and see if the steps below won't help you out.


Ha. I wasn't familiar with scan_ffs, so I googled it. Given what it does, or purports to do, yeah, a first step of "Panic" makes total sense. Reminds me of something which happened early in my career. An older, wiser coworker came by and said, "You won't believe what I almost did. I was installing a new disk on cyclops (our main NFS server), and I almost typed 'newfs /dev/sda' instead of 'newfs /dev/sdb'" (this was on SunOS 4, iirc). Then he went back to his office, hit return a couple times and... he had left "newfs /dev/sda_" sitting there on the command line. Panic ensued. We recovered from backup tapes.


For those who are wondering: The Linux equivalent is “findsuper”, which is from the e2fsprogs package, but the “findsuper” command is not normally built and installed, so when you need it, you will have to download the e2fsprogs source and compile findsuper yourself. An unnecessary pain at the worst possible time, sadly.


> so I googled it

uh... the man page? XD


sunos4 disk devices were named like xy0a or xd2h or sd1b. the first 2 letters were the controller (xy/xd were different types of xylogics smd controllers, sd scsi), the number was the unit number, and the letter was the partition, with some fairly strong conventions (a=root, b=swap, c=whole disk, d..h=other)


I love man pages. But it took me many years before I realized how easy it is to write man pages for tools that I write (and further, I write in markdown and pandoc happily translates them to troff for me).

A few years ago I learned that one can also add a new section to man. I've added the `eg` section, which I fill with examples that I think will be useful to future me. For example, typing `man eg awk` opens up my man page of examples for awk, which is more pointed.


> They are almost without exception well-written and concise, and the intuition you gain for particular topics as you browse through the man pages is well worth the effort. In contrast, many developers shoot straight to googling the answer for the problem at hand.

Maybe worth the effort if you want to learn about a program in detail, but in practice I often give up reading the manual and use google instead because I just want to know/remind myself the most common use cases. To be fair, there are some man pages that have a great USAGE or EXAMPLES section which meet this purpose.


If you create and distribute an executable for linux/unix, and you don't create a man page for it, you are committing a crime against humanity.



Huh, I wonder how close that is to what `ronn` does (also markdown to man, via a couple of paths, written in ruby.)


> If you create and distribute an executable for linux/unix, and you don't create a man page for it, you are committing a crime against humanity.

I agree.

And it's so easy to do! As long as your program has a --help option, creating the manpage simply amounts to calling help2man. Just add this to your makefile:

    foo.1 : foo ; help2man -N foo > foo.1


man has an Easter egg for anyone interested:

https://git.savannah.gnu.org/cgit/man-db.git/commit/?id=84bd...



I remember some old man page (su? sudo?) complaining quite bitterly about the wheel group not sharing its power or something, but can't seem to remember it.


Didn't GNU man pages use to have a lot more examples in the 90s ? At some point (IIRC) examples were purged. A great disservice.


I don't remember what exactly happened, but a lot of manpages moved over to `info` and `man` would just complain and send you there.

These days I use `tldr` (via `tealdeer`) and that usually spits out a few nice example commands.


Was there a rationale?


"The GNU folks, in general, abhor man pages, and create info documents instead."


My favorite is entering "extreme bounce zone"Just take a look at the stupid tricks sampler at the end of GNU man!


The best pages are terse. My favorite snippet:

    Sharp and newline surround comments.
I think from a old awk man page?


It seems to be from make(1) : http://man.cat-v.org/unix_7th/1/make


Thank you!


My fav:

"You can tune a filesystem, but you can't tune a fish." --tunefs(8), 4.2BSD and later


I appreciate that this is listed as a bug.


POSIX_ME_HARDER




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: