7 Cool Ways To Use The Man Pages In Linux

Man pages (short for manual pages) are the extensive documentation that comes preinstalled with almost all substantial Unix and Unix-like operating systems. The Unix command used to display them is man. Each page is a self-contained document.

Usage

To read a manual page for a Unix command, one can use

 man <command_name>

1) Create a pdf version of a manpage

man -t manpage | ps2pdf – filename.pdf

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 :-)

2) Colorful man

apt-get install most && update-alternatives –set pager /usr/bin/most

That command installs “most” and make this command as the default man reader. The “most” works like “less” (the current man reader), but it render colors for manpages and may do more things. Read “man most”.

You can see a preview here: http://www.dicas-l.com.br/dicas-l/20090718.php

3) Print out a man page

man -t man | lp

man -t manpagename gives a postscript version of said man page. You then pipe it to ls, and assuming you have cups set up, it prints in your default printer.

4) Search manpages for a keyword

man -k <keyword>

Search manpages for a keyword. Very useful when you don’t know where to find the information.

5) Show File System Hierarchy

man hier

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

6) Convert “man page” to text file

man ls | col -b > ~/Desktop/man_ls.txt

You can convert any UNIX man page to .txt

7) Launch a command from a manpage

!date

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/…).