What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again.

Delete that bloated snippets file you've been using and share your personal repository with the world. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

If you have a new feature suggestion or find a bug, please get in touch via http://commandlinefu.uservoice.com/

Get involved!

You can sign-in using OpenID credentials, or register a traditional username and password.

First-time OpenID users will be automatically assigned a username which can be changed after signing in.

Universal configuration monitoring and system of record for IT.

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for:



May 19, 2015 - A Look At The New Commandlinefu
I've put together a short writeup on what kind of newness you can expect from the next iteration of clfu. Check it out here.
March 2, 2015 - New Management
I'm Jon, I'll be maintaining and improving clfu. Thanks to David for building such a great resource!

Top Tags





Commands using man from sorted by
Terminal - Commands using man - 61 results
man -Pcat urxvt | \ # see description for full command
2014-07-16 23:14:14
User: malathion
Functions: man

man -Pcat urxvt | sed -n '/th: b/,/^B/p'|sed '$d'|sed '/^ \{7\}[a-z]/s/^ */^/g' | sed -e :a -e 'N;s/\n/@@/g;ta;P;D' | sed 's,\^\([^@]\+\)@*[\t ]*\([^\^]\+\),! \2\n! URxvt*\1\n\n,g' | sed 's,@@\( \+\),\n\1,g' | sed 's,@*$,,g' | sed '/^[^!]/d' | tr -d "'\`"

Prints a precompiled list of options to add to your Xresources.

Provided by Charles Torvalds here: http://www.askapache.com/linux/rxvt-xresources.html#Output_RXVT_Resources

man inet
rtfm() { help $@ || man $@ || xdg-open "http://www.google.com/search?q=$@"; }
2014-04-25 04:17:03
User: KlfJoat
Functions: man

Same as the other rtfm's, but using the more correct xdg-open instead of $BROWSER.

I can't find a way to open info only if the term exists, so it stays out of my version.

man foobar | less +/searched_string
2013-11-06 18:50:11
User: mcescalante
Functions: less man

This will open the manpage for "foobar", and display all instances of "searched_string". You can traverse through them by pressing "n"

2013-04-05 16:08:01
Functions: man

Just type man and the name of the command you want information on followed by enter.. POW!!! there you have all you need to know on the subject.

man ls | egrep "^([A-Z]| [A-Z])"
2013-01-09 17:12:03
User: bartonski
Functions: egrep ls man

Uses the formatting of a man page to show an outline of its headers and sub-headers.

man -HBrowser manpage
2012-06-04 19:14:34
User: cassvin
Functions: man

Specify the Browser where you want to open the manpage.

man -t ls > ls.ps && pdf2ps ls.ps && rm ls.ps
man ascii
2012-01-26 20:39:13
User: titan2x
Functions: man

It shows the complete ascii table, and it works in BSD too, not only in Linux.

MANWIDTH=70 man 7 man
2012-01-13 19:42:30
User: escondida
Functions: man
Tags: man bashrc

Typographically speaking, it's generally the [accepted wisdom][1] that about 60 characters per line makes for optimal reading (would that more Web pages followed this convention!). I know I got tired of reading manpages with text as wide as my screen! However, the command above sets manwidth to 70 rather than 60 because paragraphs in manpages are generally indented.

I recommend the following snippet for your .${SHELL}rc, which sets manwidth to 70 unless your terminal is smaller than 70 characters:

function man () {

if [[ $COLUMNS -gt 70 ]]; then

MANWIDTH=70 command man $*


command man $*



[1]: https://en.wikipedia.org/wiki/Column_(typography)

man -t man | ps2pdf - temp.pdf; evince temp.pdf &> /dev/null &; sleep 3; rm temp.pdf
2011-12-08 17:40:47
User: threv
Functions: man rm sleep

Yeah yeah, another "render man page in pdf", but this time it creates a temporary PDF that stays resident in memory for viewing, but is eliminated on the filesystem.

Replace evince with your PDF viewer of choice.

man -t awk | ps2pdf - awk.pdf
man <command> then type h
2011-10-16 09:49:56
User: stanix
Functions: man type

Read all chapters up to 'Jumping', improve your effectiveness of wirking in terminal.

Most useful are the Moving and Searching commands

man () { if [[ $(type ${1}) =~ "is a shell builtin" ]]; then; /usr/bin/man -P "/usr/bin/less -iRs --pattern=\"^ *${1}\"" bash; else; /usr/bin/man ${1}; return; fi; }
2011-08-25 20:27:16
Functions: man type

ulimit [-SHacdflmnpstuv [limit]]

Provides control over the resources available to the shell and to processes started by it, on systems that allow such control. The -H

and -S options specify that the hard or soft limit is set for the given resource. A hard limit cannot be increased once it is set; a

soft limit may be increased up to the value of the hard limit. If neither -H nor -S is specified, both the soft and hard limits are set.

# jumps straight to the definition of ulimit in the bash man page.

manswitch () { man $1 | less -p "^ +$2"; }
2011-08-19 16:44:48
User: dbh
Functions: less man
Tags: grep switch


manswitch grep -o

This will take you to the relevant part of the man page, so you can see the description of the switch underneath.

manswitch() { man $1 | grep -A5 "^ *\-$2"; }
2011-08-19 08:36:54
User: totti
Functions: grep man
Tags: man grep switch

Find the usage of a switch with out searching through the entire man page.

Usage: manswitch [cmd] [switch]


manswitch grep silent


In simple words

man <cmd> | grep "\-<switch>"


man grep | grep "\-o"

This is not a standard method but works.

man emacs
2011-08-17 00:37:00
User: cwimmer
Functions: man

Emacs backs up previous versions by default.

rtfm() { help $@ || man $@ || open "http://www.google.com/search?q=$@"; }
2011-01-26 06:23:42
User: vaporub
Functions: man
Tags: man google

Simple edit to work for OSX.

Now just add this to your ~/.profile and `source ~/.profile`

rtfm() { help $@ || info $@ || man $@ || $BROWSER "http://www.google.com/search?q=$@"; }
2011-01-05 21:26:51
Functions: info man
Tags: man info google

Some commands have more information on 'info' than in the man pages

rtfm() { help $@ || $@ -h || $@ --help || man $@ || $BROWSER "http://www.google.com/search?q=$@"; }
2011-01-05 17:36:26
User: karol
Functions: man
Tags: man google

Sometimes you don't have man pages only '-h' or '--help'.

rtfm() { help $@ || man $@ || $BROWSER "http://www.google.com/search?q=$@"; }
man -t manpage | ps2pdf - filename.pdf
2010-12-19 22:40:18
User: TetsuyO
Functions: man

Quick and dirty version. I made a version that checks if a manpage exists (but it's not a oneliner). You must have ps2pdf and of course Ghostscript installed in your box.

Enhancements appreciated :-)

man !!
2010-09-24 13:38:17
User: pahnin
Functions: man

when we work with terminal often we open man pages for help if we did some mistakes

and when we want to open the man page for command we are working with this one helps

as many people may be knowing that '!!' performs the last command action

we use it in sudo !! to perform the last action with root previleages

man !! will also be helpful and handy


man $(ls -1 /usr/share/man/man?/ | shuf -n1 | cut -d. -f1)
2010-08-20 23:36:10
User: dooblem
Functions: cut ls man
Tags: man sort shuf

Another one.

Maybe not the quicker because of the sort command, but it will also look in other man sections.

updated with goodevilgenius 'shuf' idea

man $(ls /bin | shuf | head -1)
2010-08-20 23:12:51
Functions: head ls man
Tags: man

I'm not sure why you would want to do this, but this seems a lot simpler (easier to understand) than the version someone submitted using awk.