In this installment of "Conquer The Command Line" we talk about how to use the Linux man
command.
man
is the first Linux command you should learn. It helps you learn all other Linux commands. Let's get to it.
Whenever you want to know how to use a command, type man
followed by the name of the command. Man will display the first man page it finds. Some commands fall under multiple categories.
Type man
by itself to get a reminder of how to use the man
command.
Linux commands are divided into the following groups, identified by a number:
- 1 is USER COMMANDS.
- 2 is kernel SYSTEM CALLS.
- 3 is C LIBRARY FUNCTIONS.
- 4 is DEVICES.
- 5 is FILES FORMATS and FILESYSTEMS.
- 6 is GAMES.
- 7 is MISCELLANEOUS COMMANDS, conventions and overviews.
- 8 is SUPERUSER AND SYSTEM ADMINISTRATOR COMMANDS.
man
is the definitive source for every possible option having to do with linux commands. If you want an easier-to-read explanation of a command and you don't want to waid through the explanation from man
, head on over to TLDR Pages. You can type the name of a command right on the site or install one of the clients that have sprung up.
Here is an Explanation of how to read a man page.
If you forget which command does something, but you know it has something to do with a topic or something you're trying to do, you can use a command line option -k
like this.
https://gist.github.com/bd37553f47ab9d24c91905abdb98ba9f
Where <keyword>
is what you want to find.
Man can sometimes produce screens and screens full of information about a command. The content can go by too quickly to read. One way to read long pages is to "pipe" two commands together. Piping is taking the output of a command and feeding it into the input of another. less
is a program that can display output to the screen, then stop, wait for you to read, then continue.
To pipe a command, use the |
character. Here is how you would use less
to display documentation for the ls
command a screen at a time.
https://gist.github.com/7e794fdc29f9409720e2ae13827cd34d
Hopefully this post has helped you take one more step in conquering the command line. I welcome any feedback.
This post was originally written at https://www.jimhomme.com