When you’re stuck and need help with a Linux command, help is usually only a few keystrokes away! Help on most Linux commands is typically built right into the commands themselves, available through online help programs (“man pages” and “info pages”), and of course online.
Using a Command’s Built-In Help
Many commands have simple “help” screens that can be invoked with special command flags. These flags usually look like “-h” or “–help”.
Example: grep --help
Online Manuals: “Man Pages”
The best source of information for most commands can be found in the online manual pages, known as “man pages” for short. To read a command’s man page, type “man command”.
Examples: man ls Get help on the “ls” command. man man A manual about how to use the manual!
To search for a particular word within a man page, type “/word”. To quit from a man page, just type the “Q” key.
Sometimes, you might not remember the name of Linux command and you need to search for it. For example, if you want to know how to change a file’s permissions, you can search the man page descriptions for the word “permission” like this:
man -k permission
If you look at the output of this command, you will find a line that looks something like:
chmod (1) - change file access permissions
Now you know that “chmod” is the command you were looking for. Typing “man chmod” will show you the chmod command’s manual page!
Some programs, particularly those released by the Free Software Foundation, use info pages as their main source of online documentation. Info pages are similar to man page, but instead of being displayed on one long scrolling screen, they are presented in shorter segments with links to other pieces of information. Info pages are accessed with the “info” command, or on some Linux distributions, “pinfo” (a nicer info browser).
For example: info df Loads the “df” info page.