Commands tagged man (36)

  • Curious about differences between /bin, /usr/bin, and /usr/local/bin? What should be in the /sbin dir? Try this command to find out. Tested against Red Hat & OS X

    man hier
    haivu · 2010-01-26 16:31:05 2
  • 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 -t manpage | ps2pdf - filename.pdf
    TetsuyO · 2010-12-19 22:40:18 5

    rtfm() { help $@ || man $@ || $BROWSER "$@"; }
    hunterm · 2011-01-05 02:53:38 10
  • You can convert any UNIX man page to .txt

    man ls | col -b > ~/Desktop/man_ls.txt
    vigo · 2009-06-13 11:49:33 2
  • Add the followin to ~/.bashrc #colour export LESS_TERMCAP_mb=$'\E[01;31m' export LESS_TERMCAP_md=$'\E[01;37m' export LESS_TERMCAP_me=$'\E[0m' export LESS_TERMCAP_se=$'\E[0m' export LESS_TERMCAP_so=$'\E[01;44;33m' export LESS_TERMCAP_ue=$'\E[0m' export LESS_TERMCAP_us=$'\E[01;32m'

    echo "export LESS_TERMCAP_mb=$'\E[01;31m'" >> ~/.bashrc
    totti · 2011-10-20 17:34:14 1
  • Launch a command from within a manpage, vim style. This is rather trivial, but can be very useful to try out the functions described in a manpage without actually quitting it (or switching to another console/screen/...). Show Sample Output

    raphink · 2009-03-02 14:55:56 2
  • This microscript looks up a man page for each word possible, and if the correct page is not found, uses w3m and Google's "I'm feeling lucky" to output a first possible result. This script was made as a result of an idea on a popular Linux forum, where users often send other people to RTFM by saying something like "man backup" or "man ubuntu one". To make this script replace the usual man command, save it as "" in your home folder and add the following string to the end of your .bashrc file: alias man='~/' Show Sample Output

    /usr/bin/man $* || w3m -dump"$*"\&btnI | less
    d1337r · 2010-10-05 13:51:39 0
  • Some commands have more information on 'info' than in the man pages

    rtfm() { help $@ || info $@ || man $@ || $BROWSER "$@"; }
    seattlegaucho · 2011-01-05 21:26:51 2
  • Example : LC_ALL=C man less | less +/ppattern

    man <COMMAND> | less +'/pattern'
    sputnick · 2010-01-26 20:50:00 0
  • Obviously, you can replace 'man' command with any command in this command line to do useful things. I just want to mention that there is a way to list all the commands which you can execute directly without giving fullpath. Normally all important commands will be placed in your PATH directories. This commandline uses that variable to get commands. Works in Ubuntu, will work in all 'manpage' configured *nix systems. Show Sample Output

    find `echo "${PATH}" | tr ':' ' '` -type f | while read COMMAND; do man -f "${COMMAND##*/}"; done
    mohan43u · 2009-06-13 19:56:24 2
  • Sometimes you don't have man pages only '-h' or '--help'.

    rtfm() { help $@ || $@ -h || $@ --help || man $@ || $BROWSER "$@"; }
    karol · 2011-01-05 17:36:26 0
  • An easy alias for opening a manpage, nicely HTML formatted, in your set internet browser. If you get a "command exited with status 3" error you need to install groff.

    alias bman='man --html=x-www-browser'
    lordtoran · 2016-10-23 17:59:47 5
  • A great way of viewing some man page while using gnome.

    yelp man:foo
    renich · 2009-03-29 07:13:44 3

  • 2
    alias man='man -S 2:3:1'
    kev · 2012-03-29 12:02:47 2
  • There once was a day I needed this info. Show Sample Output

    for i in {a..z} ; do man -k $i |grep -i "^$i" |wc | awk 'BEGIN { OFS = ":"; ORS = "" }{print $1, "\t"}' && echo $i ;done
    braak · 2010-07-15 11:41:06 0
  • 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.

    man $(ls /bin | shuf | head -1)
    goodevilgenius · 2010-08-20 23:12:51 1
  • Simple edit to work for OSX. Now just add this to your ~/.profile and `source ~/.profile`

    rtfm() { help $@ || man $@ || open "$@"; }
    vaporub · 2011-01-26 06:23:42 1
  • Find the usage of a switch with out searching through the entire man page. Usage: manswitch [cmd] [switch] Eg: manswitch grep silent ____________________________ In simple words man <cmd> | grep "\-<switch>" Eg: man grep | grep "\-o" This is not a standard method but works. Show Sample Output

    manswitch() { man $1 | grep -A5 "^ *\-$2"; }
    totti · 2011-08-19 08:36:54 2
  • 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.

    rtfm() { help $@ || man $@ || xdg-open "$@"; }
    KlfJoat · 2014-04-25 04:17:03 0
  • Creates a PDF (over ps as intermediate format) out of any given manpage. Other useful arguments for the -T switch are dvi, utf8 or latin1.

    man -Tps ls >> && ps2pdf
    0x2142 · 2009-07-05 09:31:36 2
  • Prepends paths containing man directories to your MANPATH variable for the given top level directory. If you build or install software with non-standard documentation locations, you can just add them to your MANPATH with this little function. -xdev prevents crossing filesystem boundaries when searching for man dirs. Show Sample Output

    addman () { export MANPATH=`find $1 -xdev -type d -name man -printf %p:`${MANPATH}; }
    zoomgarden · 2010-06-12 17:47:20 1
  • Quicker way to search man pages of command for key word Show Sample Output

    function mg(){ man ${1} | egrep ${2} | more; }
    quincymd · 2010-07-01 21:14:24 0
  • If I type 'man something', I want it to find the manpage in the same order as my PATH. You can add something like this to your .bashrc # # Add my MacPorts, my personal utilities and my company utilities to my PATH. export PATH=$PATH:/opt/local/bin:$HOME/bin:/our_company_utils/bin/ # Now set the manpath based on the PATH, after man(1) parses man.conf # - No need to modify man.conf or manually modify MANPATH_MAP # - Works on Linux, FreeBSD & Darwin, unlike /etc/manpaths.d/ # Must unset MANPATH first. MANPATH is set on some systems automatically (Mac), # which causes manpath to ignore the values of PATH like /opt/local/bin (MacPorts). # Also MANPATH may be deprecated. See "SEARCH PATH FOR MANUAL PAGES" in man(1) unset MANPATH # manpath acts differently on Solaris, FreeBSD, MacOSX & GNU. This works everywhere. manpath >/dev/null # Note that MacOSX, FreeBSD & Linux have fancier ways to do some of this. (e.g. 'man --path' or 'man -q'), but this command is more universal and should work everywhere. Show Sample Output

    unset MANPATH; manpath >/dev/null
    StefanLasiewski · 2010-07-02 19:45:27 0
  • As odd as this may be, I know of servers where the man(1) command is not installed, and there is not enough room on / to install it. However, zcat(1), nroff(1) and less(1) are. This is a way to read those documents without the proper tool to do so, as sad as this may seem. :)

    zcat /usr/share/man/man1/man.1.gz | nroff -man | less
    atoponce · 2011-09-07 01:13:57 0
  • 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 $* else command man $* fi } [1]:

    MANWIDTH=70 man 7 man
    escondida · 2012-01-13 19:42:30 0
  •  1 2 > 

What's this? is the place to record those command-line gems that you return to again and again. 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.

Share Your Commands

Check These Out

Create strong, but easy to remember password
Why remember? Generate! Up to 48 chars, works on any unix-like system (NB: BSD use md5 instead of md5sum)

List your largest installed packages.
Calculates the size on disk for each package installed on the filesystem (or removed but not purged). This is missing the $ | sort -rn which would put the biggest packges on top. That was purposely left out as the command is slightly on the slow side Also you may need to run this as root as some files can only be checked by du if you can read them ;)

Extract public key from private
This will extract the public key that is stored in the private key using openssl.

Replace space in filename
This commands removes space from all the files with specific extension. I've specifed *.jpg as an example.

Check a server is up. If it isn't mail me.
This version uses netcat to check a particular service.

Alert visually until any key is pressed
I learned a few things reading this command. But I did run into a few issues: 1. On systems that don't use GNU echo (e.g. macOS 10.14.5 Mojave), the e option may not be supported. In this case ANSI escape codes will echoed as text and the terminal will not flash, like this: \e[?5h\e[38;5;1m A L E R T Thu Jun 20 16:31:29 PDT 2019 2. Since the read command strips\ignores leading backslashes, if a user types the backslash character once in the loop, it will not break. Typing backslash twice in a loop will break as expected. 3. The foreground color is set to red (\e[38;5;1m) on every loop. This could be set once before we call while, and then reset once when the loop breaks. 4. Instead of resetting the foreground color when it breaks, the video mode is set back to normal (\e[?5l). This has the effect of leaving the terminal text red until it is manually reset. The alternative I'm proposing here addresses these issues. I tested it on macOS and Arch Linux.

Execute a command, convert output to .png file, upload file to, then returning the address of the .png.
My key is the anonymous one, is good for 50 post an hour with a maximun number of uploads a day, probably will run out, if that happend you can get a free key at the site.

Break lines after, for example 78 characters, but don't break within a word/string
Per default, linux/unix shells are configured with a width of 80 characters. If you like to edit a phrase or string on a line with more than 80 characters it might take long to go there (for example a line with 1000 characters and you like to edit the 98th word which is character 598-603). Maybe you might wish to use 78 characters, because if you forward the text via mail and the text will be quoted (2 extra characters at the beginning to the line "> "), you use 80 characters, otherwise 82, which are lame.

Get AWS temporary credentials ready to export based on a MFA virtual appliance
You might want to secure your AWS operations requiring to use a MFA token. But then to use API or tools, you need to pass credentials generated with a MFA token. This commands asks you for the MFA code and retrieves these credentials using AWS Cli. To print the exports, you can use: `awk '{ print "export AWS_ACCESS_KEY_ID=\"" $1 "\"\n" "export AWS_SECRET_ACCESS_KEY=\"" $2 "\"\n" "export AWS_SESSION_TOKEN=\"" $3 "\"" }'` You must adapt the command line to include: * $MFA_IDis ARN of the virtual MFA or serial number of the physical one * TTL for the credentials

Stripping ^M at end of each line for files
just deletes to rogue CR from dos files, and tr is always available.

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.


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: