[2024-feb-29] Sad news: Eric Layton aka Nocturnal Slacker aka vtel57 passed away on Feb 26th, shortly after hospitalization. He was one of our Wiki's most prominent admins. He will be missed.

Welcome to the Slackware Documentation Project

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
howtos:general_admin:searching_and_reading_manpages_efficiently [2012/12/31 13:33 (UTC)] – [The Structure of the Manpages] hazelhowtos:general_admin:searching_and_reading_manpages_efficiently [2015/09/14 17:33 (UTC)] (current) – [Navigation within a Manpage] add forgotten 'n' to 'manpage in 3rd line. cedric
Line 1: Line 1:
 +<!-- Reviewed 2013-01-06 mfillpot -->
 +<!-- Reviewed 2012-12-31 hazel -->
 <!-- Add your text below. We strongly advise to start with a Headline (see button bar above). --> <!-- Add your text below. We strongly advise to start with a Headline (see button bar above). -->
 ====== How to search and read Manpages efficiently ====== ====== How to search and read Manpages efficiently ======
  
-I hope this Howto can help some of you, although I'm aware that many of the readers are already familiar with this subject.+Manpages are pages in the online Unix Manual. I hope this Howto can help 
 +some of you to use them more effectively, although I'm aware that many of 
 +the readers are already familiar with this subject.
  
 ===== Searching for a Manpage ===== ===== Searching for a Manpage =====
-In order to search for information about anything in the manpages you can use one of the following commands:+In order to search for information about anything in the manpages you can 
 +use one of the following commands:
   * ''apropos''   * ''apropos''
   * ''man -k''   * ''man -k''
   * ''whatis''   * ''whatis''
-''apropos'' is only an alias for ''man -k''; there is no difference between them. The difference between ''whatis'' and the other commands is that ''whatis'' searches for whole words whereas ''apropos'' (or ''man -k'' respectively) searches for parts of strings. +''apropos'' is only an alias for ''man -k''; there is no difference between 
 +them. The difference between ''whatis'' and the other commands is that 
 +''whatis'' searches for whole words whereas ''apropos'' (or ''man -k'' 
 +respectively) searches for parts of strings.
  
-If you don't know how exactly a word, for example a command, is written, you can use ''apropos''. If you know exactly the word to search for, ''whatis'' would be more efficient because it results in fewer lines of output.+If you don't know how exactly a word, for example a command, is written, you 
 +can use ''apropos''. If you know exactly the word to search for, ''whatis'' 
 +would be more efficient because it results in fewer lines of output.
  
 === Example === === Example ===
Line 18: Line 28:
 With the ''apropos'' command: With the ''apropos'' command:
 <code> <code>
-markus@samsung:~$ apropos dhcp +user@darkstar$ apropos dhcp 
-dhclient []          (8)  - script - DHCP client network configuration script      +dhclient []          (8)  - script - DHCP client network configuration script 
-dhclient.conf []     (5)  - DHCP client configuration file                         +dhclient.conf []     (5)  - DHCP client configuration file 
-dhclient.leases []   (5)  - DHCP client lease database                             +dhclient.leases []   (5)  - DHCP client lease database 
-dhcp []              (5)  - eval - ISC DHCP conditional evaluation                 +dhcp []              (5)  - eval - ISC DHCP conditional evaluation 
-dhcp []              (5)  - options - Dynamic Host Configuration Protocol options  +dhcp []              (5)  - options - Dynamic Host Configuration Protocol options 
-dhcpcd []            (8)  - an RFC 2131 compliant DHCP client                      +dhcpcd []            (8)  - an RFC 2131 compliant DHCP client 
-dhcpcd []            (8)  - run-hooks - DHCP client configuration script           +dhcpcd []            (8)  - run-hooks - DHCP client configuration script 
-dhcpcd.conf []       (5)  - dhcpcd configuration file                              +dhcpcd.conf []       (5)  - dhcpcd configuration file 
-dhcpctl_initialize [] (3)  - dhcpctl library initialization                        +dhcpctl_initialize [] (3)  - dhcpctl library initialization 
-dhcpctl_initialize [] (3p)  - dhcpctl library initialization                       +dhcpctl_initialize [] (3p)  - dhcpctl library initialization 
-dhcpd []             (8)  - Dynamic Host Configuration Protocol Server             +dhcpd []             (8)  - Dynamic Host Configuration Protocol Server 
-dhcpd.conf []        (5)  - dhcpd configuration file                               +dhcpd.conf []        (5)  - dhcpd configuration file 
-dhcpd.leases []      (5)  - DHCP client lease database                            +dhcpd.leases []      (5)  - DHCP client lease database
 dnsmasq []           (8)  - A lightweight DHCP and caching DNS server dnsmasq []           (8)  - A lightweight DHCP and caching DNS server
 </code> </code>
 With the ''whatis'' command: With the ''whatis'' command:
 <code> <code>
-markus@samsung:~$ whatis dhcp                                                      +user@darkstar$ whatis dhcp 
-dhcp []              (5)  - eval - ISC DHCP conditional evaluation                 +dhcp []              (5)  - eval - ISC DHCP conditional evaluation 
-dhcp []              (5)  - options - Dynamic Host Configuration Protocol options +dhcp []              (5)  - options - Dynamic Host Configuration Protocol options
 </code> </code>
 For both commands, the search is case-insensitive! For both commands, the search is case-insensitive!
  
 ===== Updating the ''whatis'' Database ===== ===== Updating the ''whatis'' Database =====
-The ''whatis''command has its own database. The manpages for any packages of the stock Slackware installation are already present in the database. This is also true if you upgrade such packages. But if you build your own packages from source, for example from [[http://www.slackbuilds.org|SlackBuilds.org]], the manpages for these packages are not yet present in the ''whatis'' database. In order to update the database after installing new packages, Slackware provides the ''makewhatis'' command. It has to be executed as root.+The ''whatis''command has its own database. The manpages for any packages of 
 +the stock Slackware installation are already present in the database. This 
 +is also true if you upgrade such packages. But if you build your own 
 +packages from source, for example from 
 +[[http://www.slackbuilds.org|SlackBuilds.org]], the manpages for these 
 +packages are not yet present in the ''whatis'' database. In order to update 
 +the database after installing new packages, Slackware provides the 
 +''makewhatis'' command. It has to be executed as root.
  
-Please note that some other distributions use the ''mandb'' command for this purpose.+Please note that some other distributions use the ''mandb'' command for this 
 +purpose.
  
 ===== Sections in the Manual ===== ===== Sections in the Manual =====
-Don't confuse these sections with the sections within the structure of each manpage; they are described in the paragraph below.+Don't confuse these sections with the sections within the structure of each 
 +manpage; they are described in the paragraph below.
  
-The manpages manual is divided into eight different sections. Here is an extract from the manpage for the ''man'' command.+The manpages manual is divided into eight different sections. Here is an 
 +extract from the manpage for the ''man'' command.
 <code> <code>
 MANUAL SECTIONS  MANUAL SECTIONS 
Line 58: Line 78:
             C Library Functions              C Library Functions 
             Devices and Special Files              Devices and Special Files 
-            System File Formats and Conventions  +            File Formats and Conventions  
-            Games, etc.  +            Games et. Al.  
-            Miscellaneous pages +            Miscellanea
             System Administration tools and Daemons             System Administration tools and Daemons
 </code> </code>
-If the manual pages for a topic are divided over different sections, one can pass the section number as an additional argument to the ''man'' command.+If the manual pages for a topic are divided over different sections, one can 
 +pass the section number as an additional argument to the ''man'' command.
 === Example === === Example ===
 <code> <code>
-markus@samsung:~$ apropos man  +user@darkstar$ apropos man  
  ...   ... 
 makecontext []       (3)  - manipulate user context  makecontext []       (3)  - manipulate user context 
Line 77: Line 98:
 manuals with []      (7)  - mdoc  manuals with []      (7)  - mdoc 
 </code> </code>
-Now if you want to read the manpage about "macros to format man pages" in section 7 you'll have to execute the following command: +Now if you want to read the manpage about "macros to format man pages" in 
-<code>man 7 man</code>+section 7 you'll have to execute the following command: 
 +<code> 
 +user@darkstar$ man 7 man 
 +</code>
  
 ===== The Structure of the Manpages ===== ===== The Structure of the Manpages =====
-The manpages have (should have) all the same structure:+The manpages all have (or should have) the same structure:
   * Name   * Name
     * Name of the command and a short description of its function(s)     * Name of the command and a short description of its function(s)
Line 87: Line 111:
     * A usage statement including a short list of the options     * A usage statement including a short list of the options
   * Description   * Description
-    * A detailed explanation of the command +    * A detailed explanation of the command
   * Options   * Options
     * Detailed explanation of the command line options for the command     * Detailed explanation of the command line options for the command
   * Bugs   * Bugs
-    * Known Bugs  +    * Known Bugs
   * Author   * Author
     * The author(s) of the package and maybe the author of the manpage     * The author(s) of the package and maybe the author of the manpage
Line 97: Line 121:
     * Advice for manpages about similar or related programs     * Advice for manpages about similar or related programs
  
-If one searches for information about a subject rather than a single command the "see also" line is very interesting.+If one searches for information about a subject rather than a single 
 + command the "see also" line is very interesting.
  
 ===== Searching within a Manpage ===== ===== Searching within a Manpage =====
-The reader for the manpages is the program ''less''. Its keybindings are very similar to the vi editor. +The reader for the manpages is the program ''less''. Its keybindings are 
-With ''/'' one searches the document forward, with ''?'backwards. With ''n'the cursor jumps to the next match. The ''-'' key has no special meaning in the search patterns, so it is possible to search (for example) for the -k option with /-k+very similar to the vi editor. 
 + 
 +  * <key>'/'</key> searches the document forward 
 +  * <key>'?'</key> searched the document backwards 
 +  * <key>'n'</key> the cursor jumps to the next match. 
 + 
 +The <key>Minus</key> key has no special meaning in the search patterns, so it is 
 +possible to search (for example) for the -k option with ///-k// 
 ===Example=== ===Example===
-Searching for the -h option in the manpage for the ''ls'' command with /-h +Searching for the //-h// option in the manpage for the ''ls'' command with 
-gives us<code> -h, --human-readable  + //-h// gives us 
-              with -l, print sizes in human readable format (e.g., 1K 234M 2G)</code>+<code> 
 + -h, --human-readable  
 +              with -l, print sizes in human readable format (e.g., 1K 234M 2G) 
 +</code>
  
 ===== Navigation within a Manpage ===== ===== Navigation within a Manpage =====
-Navigation is like in vi:  +Navigation commands are like those in vi: 
-  * ''G'end of the manpage  +  * <key>'G'</key> end of the manpage 
-  * ''gg'' first line of the mapage +  * <key>g</key>,<key>g</key> first line of the manpage 
-  * ''nG'' nth line of the manpage+  * //n//,<key>'G'</key> nth line of the manpage
  
 One can also **set marks** at a line of the manpage One can also **set marks** at a line of the manpage
-  * ''ma'' sets mark a in the current line +  * //<key>m</key>,a// sets mark a in the current line 
-  * '' 'a'' jumps to mark a in the manpage +  * //<key>'</key>, a// jumps to mark a in the manpage 
-Unfortunately these marks are lost when you leave the manpage (which is done with q).+Unfortunately these marks are lost when you leave the manpage (which is 
 +done with <key>q</key>).
  
 ===== Formatting a Manpage as a PDF-document ===== ===== Formatting a Manpage as a PDF-document =====
 If you want to have a manpage as a PDF document you can use the command: If you want to have a manpage as a PDF document you can use the command:
 <code>man -t ls | ps2pdf - > ls-manpage.pdf</code> <code>man -t ls | ps2pdf - > ls-manpage.pdf</code>
-which formats the manpage for the ''ls'' command into a pdf document named "ls-manpage.pdf".+which formats the manpage for the ''ls'' command into a pdf document 
 +named "ls-manpage.pdf".
  
 ===== Further Reading ===== ===== Further Reading =====
-For more information read the manpage for the ''man'' command and read the manpages listed in "see also".+For more information read the manpage for the ''man'' command and the 
 +manpages listed in "see also".
 ====== Sources ====== ====== Sources ======
 <!-- If you are copying information from another source, then specify that source --> <!-- If you are copying information from another source, then specify that source -->
Line 135: Line 174:
 <!-- You must remove the tag-word "template" below before saving your new page --> <!-- You must remove the tag-word "template" below before saving your new page -->
 {{tag>howtos manpages searching documentation information author_markush }} {{tag>howtos manpages searching documentation information author_markush }}
 +
 howtos:general_admin:searching_and_reading_manpages_efficiently ()