Linux, Open Source, Free Software, Bicycles, and other topics of interest.
RSS icon Twitter icon
  • How to print a man page from the command line in Linux

    Posted on September 10th, 2008 linuxandfriends No comments

    Man page also called a MANual is an electronic document found commonly in all Linux and Unix operating systems. Each command will have its own man page which explains how to use that particular command.

    For example, to view the man page of the Linux command ls,  fire up a terminal and enter the following :

    $ man ls

    Print a man page

    You can print a man page from the command line as follows :

    $ man -t <command> | lpr

    -t indicates that ‘man‘ must format the manual to be used for the printer. The output of ‘man -t‘  is in a printing language called postscript.

    So for example, to print the man page of cat command, we can do the following :

    $ man -t cat | lpr

    By using the command lpr after the pipe, you are sending the output to the printer. But before you send the entire manual to the printer, it is always prudent to check the number of pages that will be send to the printer. This is done by using the wc command as follows :

    $ man cat | wc -l
    71

    71 lines above translates to less than a page since 80 lines fit on an A4 page. If a manual has lots more lines, dividing the lines by 80 will give you an approximate idea of the number of pages that will be used by the printer to print the manual.

    http://linuxandfriends.com/wp-content/plugins/sociofluid/images/digg_48.png http://linuxandfriends.com/wp-content/plugins/sociofluid/images/reddit_48.png http://linuxandfriends.com/wp-content/plugins/sociofluid/images/stumbleupon_48.png http://linuxandfriends.com/wp-content/plugins/sociofluid/images/delicious_48.png http://linuxandfriends.com/wp-content/plugins/sociofluid/images/google_48.png http://linuxandfriends.com/wp-content/plugins/sociofluid/images/myspace_48.png http://linuxandfriends.com/wp-content/plugins/sociofluid/images/facebook_48.png http://linuxandfriends.com/wp-content/plugins/sociofluid/images/yahoobuzz_48.png http://linuxandfriends.com/wp-content/plugins/sociofluid/images/mixx_48.png http://linuxandfriends.com/wp-content/plugins/sociofluid/images/twitter_48.png

    Related Posts

    Comments are closed.