The man command is one of the most important tools in Linux—it stands for "manual."
It is the built-in interface for viewing the system's reference manuals. Whenever you are unsure about how a command works or what its options (like -n) do, you use man.
How to use it:
To see the manual for a specific command, type man followed by the command name:
man cat
What happens next?
When you run a man command, an interactive viewer opens. It usually includes several sections:
- NAME: The name of the command and a brief description.
- SYNOPSIS: How to correctly type the command (its syntax).
- DESCRIPTION: A detailed explanation of what the command does.
- OPTIONS: A list of all the flags (like
-n,-b, etc.) and what they do.
Navigating the manual:
While inside a manual page, you can use these keys:
- Arrow Keys: Scroll up or down.
- Spacebar: Scroll down one full page at a time.
/keyword: Search for a specific word (e.g., type/numberwhile in thecatmanual to find where it explains line numbering).q: Press this to quit the manual and return to your command prompt.
Try it out!
Since you just used cat -n, try typing man cat in your terminal. Look for the -n or --number flag in the description to see how it's officially documented!