Jason Turley's Website

man man

In this post we’ll take a cursory glance at man pages - what they are, the different sections, and tips on using them.

What are man pages?

Man pages, short for manual, contain information on how to use programs, tools, and functions. They are something every *nix user must have in their toolkit.

They are super intuitive to use. For example, to read the man page for netstat type:

$ man netstat

Sections

You can optionally provide a section argument to direct the man command to only search for results in that category.

man [section] page

The section number is displayed in the header of the man page in parenthesis. Here’s what the section heading looks like for the ls command:

section

There are nine (9) sections that are referenced by their section number:

1) Executable programs or shell commands

These are the basic commands that you are use to running everyday. They help with navigating the file system, displaying text to the screen, and finding files.

Examples: ls, bash, cd, find

2) System calls

System calls are functions and commands that the kernel provides. They typically all deal with low level tasks: process create, memory management, file permissions, etc.

Examples: fork, wait, chown, poll

3) Library calls

This section contains functions found in programming language libraries. The library I am most familiar with is libc, the C library.

Examples: printf, exit, pthread_create, getaddrinfo

4) Special files

Everything in Linux is a file. And some of those files are special. So special in fact, that they get their own section!

I think special files are extremely interesting, perhaps I’ll write a post about them one day.

Special files are typically located in /dev.

Examples: null, urandom, loop, tty

5) File formats and conventions

Contains information about (non special) files that a system admin, hacker, or engineer may come across.

Examples: proc, passwd, access.conf

6) Games

That’s right, GAMES! Linux stores installed games in /usr/local/games. There may not be any installed in that folder by default, but you can search for game-like programs with:

$ man 6 <tab>

My newfound favorite tool is figlet!

Examples: figlet, chkfont

7) Miscellaneous

All the miscellaneous functions are placed here, including macro packages and conventions. There are a ton of tools here - everything from tutorials to servers.

Examples: samba, daemon, gittutorial

8) System administrator commands

These are commands that would usually be run with admin (aka root) level permissions. Normal end users would not be running these (or at least they shouldn’t!).

Examples: iptables, service, shutdown, zdump

9) Kernel routines [Non standard]

The last section is reserved for kernel routines, functions that are used when programming Linux kernel modules and device drivers.

Examples: printk, kmalloc, vmalloc

Tips

Now for some quick tips!

Conclusion

Thanks for taking the time to read this post! I had a lot of fun learning more about a tool that I use almost every day. Linux truly is a beautiful operating system and I will never cease to be amazed by the functionality is offers.

RTFM

#favorites #linux