version 10, including all changes.
.
Rev |
Author |
# |
Line |
3 |
BenStaz |
1 |
!Must Read |
|
|
2 |
|
4 |
BenStaz |
3 |
I think a lot of people use the man command without knowing they can specify a section number to get more relevant information. |
3 |
BenStaz |
4 |
|
|
|
5 |
For example a person without the knowledge of man sections may want to know the structure of the 'passwd' file and type 'man passwd'. They receive a page telling them all about the 'passwd' command and they assume the information they seek is not available using man, when really it is. |
|
|
6 |
|
|
|
7 |
Thanks to : http://www.linux-tutorial.info |
|
|
8 |
|
|
|
9 |
When referring to a particular command in Linux documentation, you very often will see the name followed by a letter or number in parenthesis, such as ls(1). This indicates that the ls command can be found in section 1 of the man-pages. This dates back to the time when man-pages came in books (as they often still do). By including the section, you could more quickly find what you were looking for. |
|
|
10 |
|
|
|
11 |
For a list of what sections are available, see the table below or the man man-page. If you are looking for the man-page of a particular command and know what section it is in, it is often better to specify the section. Sometimes there are multiple man-pages in different sections. For example, the passwd man-page in section 1 lists the details of the passwd command. The passwd man-page in section 5, lists the details of the /etc/passwd file. Therefore,if you wanted the man-page on the passwd file, you would use: |
|
|
12 |
|
|
|
13 |
*man 5 passwd |
|
|
14 |
|
|
|
15 |
Here is a list of the sections and a brief description of what can be found in each section: |
|
|
16 |
|
|
|
17 |
1) Commands, Utilities and other executable programs, which are typically user-related |
|
|
18 |
2) System calls |
|
|
19 |
3) Library calls |
|
|
20 |
4) Special files, typically device files in /dev |
|
|
21 |
5) File formats and their respective conventions, layout |
|
|
22 |
6) Games |
|
|
23 |
7) Macro packages |
|
|
24 |
8) System administration commands |
|
|
25 |
9) Kernel routines |
|
|
26 |
|
2 |
BenStaz |
27 |
!Not happy with your default man viewer? |
|
|
28 |
|
|
|
29 |
Then change it! This is easily done by setting the 'PAGER' environment variable. |
|
|
30 |
|
|
|
31 |
I am using Debian Etch which by default uses 'less' as the man viewer. |
|
|
32 |
But say I want to use 'more' to view man pages instead. |
|
|
33 |
|
|
|
34 |
*export PAGER="/path/to/more" |
|
|
35 |
|
|
|
36 |
Now type 'man ls' for example, and notice the man viewer has changed :) |
|
|
37 |
|
|
|
38 |
If you regret the change simply do: |
|
|
39 |
|
|
|
40 |
*unset PAGER |
|
|
41 |
|
|
|
42 |
to revert back to the default man page viewer. |
|
|
43 |
|
|
|
44 |
Remember, to make changes to an environment variable permanent you will have to add the export command to your shell initialization script. |
|
|
45 |
|
1 |
BenStaz |
46 |
!You can Search a man Document |
2 |
BenStaz |
47 |
|
|
|
48 |
Note: This only applies when using 'less' to view man pages. |
1 |
BenStaz |
49 |
|
|
|
50 |
When viewing a man for a particular application, you can search for a keyword you are after by typing: |
|
|
51 |
|
|
|
52 |
*/<search> |
|
|
53 |
|
|
|
54 |
The man will scroll down to the first match, and any matches will be highlighted! |
2 |
BenStaz |
55 |
|
8 |
PerryLorier |
56 |
To search [backwards|WhosOnFirst]: |
2 |
BenStaz |
57 |
|
|
|
58 |
*?<search> |
5 |
BenStaz |
59 |
|
|
|
60 |
!Help I forgot the name of a command! |
|
|
61 |
|
|
|
62 |
In the man command you can specify a keyword to search for inside the description of the command you are looking for. |
|
|
63 |
For example if you remembered the application had something to do with partitioning: |
|
|
64 |
|
|
|
65 |
*man -k partition |
|
|
66 |
|
|
|
67 |
Results in: |
|
|
68 |
|
6 |
BenStaz |
69 |
<verbatim> |
5 |
BenStaz |
70 |
cfdisk (8) - Curses based disk partition table manipulator for Linux |
|
|
71 |
fdisk (8) - Partition table manipulator for Linux |
|
|
72 |
parted (8) - a partition manipulation program |
|
|
73 |
partprobe (8) - inform the OS of partition table changes |
|
|
74 |
sfdisk (8) - Partition table manipulator for Linux |
6 |
BenStaz |
75 |
</verbatim> |
5 |
BenStaz |
76 |
|
|
|
77 |
With a bit of luck you will find the name of the application you are after :) |
9 |
BenStaz |
78 |
|
|
|
79 |
!Manual pages about using GNU/Linux for development |
|
|
80 |
|
|
|
81 |
Forgotten the syntax for that c function? Not to worry! |
|
|
82 |
|
|
|
83 |
*sudo aptitude install manpages-dev |
|
|
84 |
|
|
|
85 |
Now you can do something like: |
|
|
86 |
|
|
|
87 |
*man 3 printf |
|
|
88 |
|
|
|
89 |
and receive a man page providing comprehensive information about how to use the printf function. |
|
|
90 |
|
|
|
91 |
Note : man section 3 = Library calls (functions within program libraries) |
|
|
92 |
|
10 |
BenStaz |
93 |
! MANSECT Environment Variable |
|
|
94 |
|
|
|
95 |
Its value is a colon-delimited list of sections and it is used to determine which manual sections to search and in what order. |
|
|
96 |
|
|
|
97 |
For example : |
|
|
98 |
|
|
|
99 |
*export MANSECT="3:1:5:2:4:8:9:7:6" |
9 |
BenStaz |
100 |
|
|
|
101 |
|
|
|
102 |
|
7 |
IanMcDonald |
103 |
---- |
|
|
104 |
CategoryNotes |