Commands using man (67)

  • You can view the man pages from section five by passing the section number as an argument to the man command Show Sample Output


    1
    man 5 crontab
    0disse0 · 2009-09-03 19:27:08 0
  • Often you find some tty programs are messed up and confused about character encoding - 'man' is a common problem and sometimes displays weird characters for apostrophes, hyphens etc etc. Another class of programs that suffer from this are those that try to use the line drawing characters - eg RedHat's tty system admin functions such as system-config-firewall-tui system-config-network-tui etc. Adding 'LC_ALL=C' fixes most of these problems (as long as you want English! Perhaps speakers of other languages can add a comment here). For bonus points, I've added the '-c' option to the man command so that it ignores it's cache and re-computes the man page using the C locale.


    1
    LC_ALL=C man -c man
    bhepple · 2010-01-07 00:59:09 0
  • 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 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.


    1
    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`


    1
    rtfm() { help $@ || man $@ || open "http://www.google.com/search?q=$@"; }
    vaporub · 2011-01-26 06:23:42 0
  • 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 2
  • This will open the manpage for "foobar", and display all instances of "searched_string". You can traverse through them by pressing "n"


    1
    man foobar | less +/searched_string
    mcescalante · 2013-11-06 18:50:11 0
  • 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 0
  • Using perl, here, we grep the man page of fetchmail to find the paragraph starting with '-k | --keep' and ending before the paragraph starting with '-K | --nokeep' Show Sample Output


    0
    man fetchmail | perl -ne 'undef $/; print $1 if m/^.*?(-k \| --keep.*)-K \| --nokeep.*$/smg'
    unixmonkey4437 · 2009-06-25 23:51:35 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.


    0
    man -Tps ls >> ls_manpage.ps && ps2pdf ls_manpage.ps
    0x2142 · 2009-07-05 09:31:36 2

  • 0
    man perlcheat | col -b > perlcheat.txt
    recursiverse · 2009-07-26 10:16:37 0
  • Output manpage as plaintext using cat as pager: man -P cat commandname And redirect its stdout into a file: man -P cat commandname > textfile.txt Example: man -P cat ls > man_ls.txt


    0
    man -P cat ls > man_ls.txt
    alvinx · 2009-07-27 13:09:24 0
  • 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 1
  • 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 0
  • 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. Show Sample Output


    0
    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; }
    adamlehenbauer · 2011-08-25 20:27:16 0
  • 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.


    0
    man -t man | ps2pdf - temp.pdf; evince temp.pdf &> /dev/null &; sleep 3; rm temp.pdf
    threv · 2011-12-08 17:40:47 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 0
  • It shows the complete ascii table, and it works in BSD too, not only in Linux.


    0
    man ascii
    titan2x · 2012-01-26 20:39:13 0
  • print pdf man ls Show Sample Output


    0
    man -t ls > ls.ps && pdf2ps ls.ps && rm ls.ps
    fekrhdesigns · 2012-04-08 11:48:25 0
  • Specify the Browser where you want to open the manpage. Show Sample Output


    0
    man -HBrowser manpage
    cassvin · 2012-06-04 19:14:34 0
  • 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 Show Sample Output


    0
    man -Pcat urxvt | \ # see description for full command
    malathion · 2014-07-16 23:14:14 0
  • This command requires groff. Install it before executing the command. I'm on my ubuntu so, I install it like this: sudo apt-get install groff You can type in your own command instead of cat. The command will be executed with the path to the html page when it's converted. For instance, this will print out the path to the html file: man -Hecho ls


    0
    man -Hcat ls
    menixator · 2014-11-19 04:42:00 0

  • 0
    man bash | grep -A 9 "Keyboard Macros"
    Tiosam · 2015-03-20 17:14:54 0

  • 0
    man ascii
    blasetherexaler · 2015-08-29 06:47:02 0

  • 0
    man -a --regex "byobu" |grep --color=always -i3P 'key[a-z-]*?s' | less -R
    VoidDroid · 2015-10-18 10:38:01 0
  •  < 1 2 3 > 

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

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

Count lines of code across multiple file types, sorted by least amount of code to greatest
The same as the other two alternatives, but now less forking! Instead of using '\;' to mark the end of an -exec command in GNU find, you can simply use '+' and it'll run the command only once with all the files as arguments. This has two benefits over the xargs version: it's easier to read and spaces in the filesnames work automatically (no -print0). [Oh, and there's one less fork, if you care about such things. But, then again, one is equal to zero for sufficiently large values of zero.]

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

Synchronize date and time with a server over ssh
Set Remote Server Date using Local Server Time (push)

dd with progress bar and statistics
This command utilizes 'pv' to show dd's progress. Notes on use with dd: -- dd block size (bs=...) is a widely debated command-line switch and should usually be between 1024 and 4096. You won't see much performance improvements beyond 4096, but regardless of the block size, dd will transfer every bit of data. -- pv's switch, '-s' should be as close to the size of the data source as possible. -- dd's out file, 'of=...' can be anything as the data within that file are the same regardless of the filename / extension.

Script Terminal Session
script -f /tmp/foo will place all output of the terminal, including carriage returns, to a file. This file can be tail dash-eff'ed by one or more other terminals to display the information of the main terminal. Good way to share one's screen on short notice. Note: This produces a very accurate output, but that includes depending on the size of your terminal to be the same. You can clear screens or even resize the terminal for others using this function; I use it in conjunction with the "mid" command in my list.

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

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

Fetch all GPG keys that are currently missing in your keyring
For instance, if people have signed your key, this will fetch the signers' keys.

Finds all files from / on down over specified size.
Very useful for finding all files over a specified size, such as out of control log files chewing up all available disk space. Fedora Core x specific version.


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: