Linux man page entries | different types

The man page(manual page) is a documentation manual of different commands available in unix or unix like operating systems.

To check manual entry for any command use, man command_name
In this article, I’m using command printf for my demonstrations.

man printf

Output:

PRINTF(1)                                                      User Commands                                                      PRINTF(1)

NAME
       printf - format and print data

SYNOPSIS
       printf FORMAT [ARGUMENT]...
       printf OPTION

DESCRIPTION
       Print ARGUMENT(s) according to FORMAT, or execute according to OPTION:

       --help display this help and exit

       --version
              output version information and exit

       FORMAT controls the output as in C printf.  Interpreted sequences are:

       \"     double quote

       \\     backslash

       \a     alert (BEL)

...

If you observe carefully the above output, the top line contains PRINTF(1), the 1 in braces is type of man entry. The number basically corresponds to section of the manual page.

The manual is split into 8 sections, which are(on Research Unix, BSD, macOS and Linux):

Section Description
1 General Commands
2 System Calls
3 Library functions, covering in particular the C standard library
4 Special files (usually devices, those found in /dev) and drivers
5 File formats and conventions
6 Games and screensavers
7 Miscellanea
8 System administration commands and daemons

Let’s continue with the example of PRINTF, for all entries, try below command:

man -a printf

Output:

PRINTF(1)                                                      User Commands                                                      PRINTF(1)

NAME
       printf - format and print data

SYNOPSIS
       printf FORMAT [ARGUMENT]...
       printf OPTION

DESCRIPTION
       Print ARGUMENT(s) according to FORMAT, or execute according to OPTION:

       --help display this help and exit

       --version
              output version information and exit

       FORMAT controls the output as in C printf.  Interpreted sequences are:

       \"     double quote

...

When you type q to exit, the below text appears on terminal, press enter to continue to see another entry of printf

--Man-- next: printf(3) [ view (return) | skip (Ctrl-D) | quit (Ctrl-C) ]

Output continued:

PRINTF(3)                                                Linux Programmer's Manual                                                PRINTF(3)

NAME
       printf, fprintf, dprintf, sprintf, snprintf, vprintf, vfprintf, vdprintf, vsprintf, vsnprintf - formatted output conversion

SYNOPSIS
       #include 

       int printf(const char *format, ...);
       int fprintf(FILE *stream, const char *format, ...);
       int dprintf(int fd, const char *format, ...);
       int sprintf(char *str, const char *format, ...);
       int snprintf(char *str, size_t size, const char *format, ...);

       #include 

       int vprintf(const char *format, va_list ap);
       int vfprintf(FILE *stream, const char *format, va_list ap);

...

To check specific entry to printf or any other command, you can directly provide section number, for example:

man 3 printf

Output: It will show man entry corresponding to section 3 of printf.

Some useful man command options:
1) -f option

man -f printf

Output:
It will display the short description of printf, if available similar to

printf - format and print data

2) -k option

man -k printf

Output:
It will search the short manual page descriptions for keywords and display any matches.

printf               (1)  - format and print data
printf               (1p)  - write formatted output
printf               (3)  - formatted output conversion
printf               (3p)  - print formatted output
printf [builtins]    (1)  - bash built-in commands, see bash(1)

3) -w option
It prints the location of cat files that will be displayed rather than the content of files.

man -w printf

Output:

/usr/share/man/man1/printf.1.gz

4) -K option
It will search for text in all manual pages.

man -K printf

Output:
It will display all man entries containing printf keyword, and after each entry is display you can press enter for viewing second entry.
For example:
The below is prompted to view second entry for printf, you can either skip it or quit to terminate the command.

--Man-- next: git-show(1) [ view (return) | skip (Ctrl-D) | quit (Ctrl-C) ]

References :
1) wiki/Man_page
2) Man entry of man



My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.