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 30
  • 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 15
  • RTFMFTW.


    42
    rtfm() { help $@ || man $@ || $BROWSER "http://www.google.com/search?q=$@"; }
    hunterm · 2011-01-05 02:53:38 323
  • 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 8
  • 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 14
  • 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 6
  • 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 43
  • Example : LC_ALL=C man less | less +/ppattern


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

This will take the last two commands from bash_history and open your editor with the commands on separated lines

Don't like the cut command? Tired of typing awk '{print $xxx}', try this

Generate a Random MAC address
Use the following variation for FreeBSD: $ openssl rand 6 | xxd -p | sed 's/\(..\)/\1:/g; s/:$//'

Find unused IPs on a given subnet
Somewhat shorter version.

List files in directory tree with newest last

grep apache access.log and list IP's by hits and date - sorted

Exclude inserting a table from a sql import
Starting with a large MySQL dump file (*.sql) remove any lines that have inserts for the specified table. Sometimes one or two tables are very large and uneeded, eg. log tables. To exclude multiple tables you can get fancy with sed, or just run the command again on subsequently generated files.

list files recursively by size

Merge files, joining each line in one line

delay execution of a command that needs lots of memory and CPU time until the resources are available
[ 2000 -ge "$(free -m | awk '/buffers.cache:/ {print $4}')" ] returns true if less than 2000 MB of RAM are available, so adjust this number to your needs. [ $(echo "$(uptime | awk '{print $10}' | sed -e 's/,$//' -e 's/,/./') >= $(grep -c ^processor /proc/cpuinfo)" | bc) -eq 1 ] returns true if the current machine load is at least equal to the number of CPUs. If either of the tests returns true we wait 10 seconds and check again. If both tests return false, i.e. 2GB are available and machine load falls below number of CPUs, we start our command and save it's output in a text file. The ( ( ... ) & ) construct lets the command run in background even if we log out. See http://www.commandlinefu.com/commands/view/3115/ .


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: