41 comments

[ 3.1 ms ] story [ 13.2 ms ] thread
this is an incredibly useful shortlist of commands, most of these I've used before - some I've used and forgotten (mount -o remount,ro)
It was on my bookmarks for a long time. I thought it would be nice to share with you guys.

There are so many times I do searches on HN to recall about some nice things I've seen oh the web... Quite often, the comments are the gems!

Bro Pages (instead of "man" pages) is a similar resource I find myself using surprisingly often http://bropages.org/browse
Damn, I remember the HN thread about that. The derailing was phenomenal. Interesting that the project lives on.
(comment deleted)
just tried out to install bro pages with a fresh ruby 2.2.1 from rvm on OS X and got this reproducable. Seems broken for me:

    $ bro curl
    The curl command isn't in our database.
That project is a symptom of manual pages not having good “EXAMPLES” sections. The examples on that web page should be contributed upstream to the manuals pages of the software that they are for.

If you want a fast way to read the EXAMPLES section only for a command, here is a shell function which creates an ‘eg’ command which only displays the “EXAMPLES” section of manual pages:

  eg(){
      MAN_KEEP_FORMATTING=1 man "$@" 2>/dev/null \
          | sed --quiet --expression='/^E\(\x08.\)X\(\x08.\)\?A\(\x08.\)\?M\(\x08.\)\?P\(\x08.\)\?L\(\x08.\)\?E/{:a;p;n;/^[^ ]/q;ba}' \
          | ${MANPAGER:-${PAGER:-pager -s}}
  }
Usage:

  $ eg tar
  EXAMPLES
       Create archive.tar from files foo and bar.
             tar -cf archive.tar foo bar
       List all files in archive.tar verbosely.
             tar -tvf archive.tar
       Extract all files from archive.tar.
             tar -xf archive.tar
  $
Thank you, this is really helpful.

Could anyone contribute a version for OSX?

If you have homebrew you can just install the 'gnu-sed' package and then change the function to call 'gsed' instead.
Here's my terribly hackish version for BSD userlands (briefly tested on FreeBSD, may work on OS X):

    #!/bin/sh
    eg () {
        man $1 | grep '^E.EX.XA' -A 1000 | grep '^[A-Z]' -m 2 -B 1000 -A 0 | sed '$d' | $PAGER
    }
    eg $1
Any ideas where I'd find how to submit the man page patches? Some upstreams are incredibly hard to find.
Can you give me an example? What I’d do it look at the Debian package, which both documents where upstream is and has a bugtracker of its own which you can submit suggestions to, and the Debian maintainer should forward the submission to upstream if appropriate.
Aaand it eludes me - I'll keep that in mind for the next time I find a manpage without examples.
This is really incredible list. Very useful when in need. Especially the switches that come in very handy.
hostname -i on cb.vu says the IP address is 78.31.70.238, but if you ping a host from the interface, the pings originate from 178.33.34.4 (according to tcpdump).
I love the "why not try this" attitude of your comment.

Is this due to an LB fronting?

On this system hostname -i says 127.0.1.1, despite this address not being set on any of my interfaces (lo0 is 127.0.0.1).
It looks like hostname -i is getting its value from /etc/hosts. hostname --all-ip-addresses returns the correct result.
This is great. Could use more on the Mac OS X side, though.
I used to know a lot of this stuff. With Puppet, Chef, and then Ansible, I've found myself needing to know less and less of it.
And instead you now need to know a layer of abstraction and relearn that layer whenever it re-invents itself.
An excellent page to keep handy or for browsing! Thanks for the link.

A different (but related) resource: http://explainshell.com - good for deciphering those tricker commands.

> 2.2 Priority - ... Every command launched from this shell will have a lover priority. ...

You probably meant lower :)