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


    95
    man hier
    haivu · 2010-01-26 16:31:05 39
  • 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 :-)


    59
    man -t manpage | ps2pdf - filename.pdf
    TetsuyO · 2010-12-19 22:40:18 19
  • RTFMFTW.


    42
    rtfm() { help $@ || man $@ || $BROWSER "http://www.google.com/search?q=$@"; }
    hunterm · 2011-01-05 02:53:38 325
  • You can convert any UNIX man page to .txt


    15
    man ls | col -b > ~/Desktop/man_ls.txt
    vigo · 2009-06-13 11:49:33 18
  • 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'


    15
    echo "export LESS_TERMCAP_mb=$'\E[01;31m'" >> ~/.bashrc
    totti · 2011-10-20 17:34:14 9
  • 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


    10
    !date
    raphink · 2009-03-02 14:55:56 16
  • 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 ".man.sh" in your home folder and add the following string to the end of your .bashrc file: alias man='~/.man.sh' Show Sample Output


    9
    /usr/bin/man $* || w3m -dump http://google.com/search?q="$*"\&btnI | less
    d1337r · 2010-10-05 13:51:39 7
  • Some commands have more information on 'info' than in the man pages


    9
    rtfm() { help $@ || info $@ || man $@ || $BROWSER "http://www.google.com/search?q=$@"; }
    seattlegaucho · 2011-01-05 21:26:51 44
  • Example : LC_ALL=C man less | less +/ppattern


    6
    man <COMMAND> | less +'/pattern'
    sputnick · 2010-01-26 20:50:00 4
  • 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


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


    4
    rtfm() { help $@ || $@ -h || $@ --help || man $@ || $BROWSER "http://www.google.com/search?q=$@"; }
    karol · 2011-01-05 17:36:26 4
  • A great way of viewing some man page while using gnome.


    3
    yelp man:foo
    renich · 2009-03-29 07:13:44 8
  • 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.


    3
    alias bman='man --html=x-www-browser'
    lordtoran · 2016-10-23 17:59:47 23

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


    1
    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 216
  • 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.


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


    1
    rtfm() { help $@ || man $@ || open "http://www.google.com/search?q=$@"; }
    vaporub · 2011-01-26 06:23:42 5
  • 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


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


    1
    rtfm() { help $@ || man $@ || xdg-open "http://www.google.com/search?q=$@"; }
    KlfJoat · 2014-04-25 04:17:03 125
  • 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.


    0
    man -Tps ls >> ls_manpage.ps && ps2pdf ls_manpage.ps
    0x2142 · 2009-07-05 09:31:36 8
  • 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


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


    0
    function mg(){ man ${1} | egrep ${2} | more; }
    quincymd · 2010-07-01 21:14:24 9
  • 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


    0
    unset MANPATH; manpath >/dev/null
    StefanLasiewski · 2010-07-02 19:45:27 5
  • 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. :)


    0
    zcat /usr/share/man/man1/man.1.gz | nroff -man | less
    atoponce · 2011-09-07 01:13:57 4
  • 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]: https://en.wikipedia.org/wiki/Column_(typography)


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

What's this?

commandlinefu.com 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

Find usb device in realtime
Using this command you can track a moment when usb device was attached.

Edit a file on a remote host using vim

Save your open windows to a file so they can be opened after you restart
This will save your open windows to a file (~/.windows). To start those applications: $ cat ~/.windows | while read line; do $line &; done Should work on any EWMH/NetWM compatible X Window Manager. If you use DWM or another Window Manager not using EWMH or NetWM try this: $ xwininfo -root -children | grep '^ ' | grep -v children | grep -v '' | sed -n 's/^ *\(0x[0-9a-f]*\) .*/\1/p' | uniq | while read line; do xprop -id $line _NET_WM_PID | sed -n 's/.* = \([0-9]*\)$/\1/p'; done | uniq -u | grep -v '^$' | while read line; do ps -o cmd= $line; done > ~/.windows

Escape forward slashes in a variable
For example $ path="/etc/apt/sources.list"; echo ${path//'/'/'\/'} will print $ \/etc\/apt\/sources.list

highlight with grep and still output file contents

list block devices
Shows all block devices in a tree with descruptions of what they are.

remove OSX resource forks ._ files
DESCRIPTION For each dir, dot_clean recursively merges all ._* files with their cor- responding native files according to the rules specified with the given arguments. By default, if there is an attribute on the native file that is also present in the ._ file, the most recent attribute will be used. If no operands are given, a usage message is output. If more than one directory is given, directories are merged in the order in which they are specified.

Separates each frame of a animated gif file to a counted file, then appends the frames together into one sheet file. Useful for making sprite sheets for games.
requires imagemagick

Redirect tar extract to another directory
The command extracting the tar contents into particular directory ...

Have subversion ignore a file pattern in a directory
If you don't want to commit files to subversion, and don't want those file to show up when doing an "svn stat", this command is what you need


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: