Skip to main content
Linux commands offer a plethora of command-line switches, making it challenging to remember every option. As you use a command regularly, you naturally learn the available options. However, during your initial attempts, it’s common to forget them after only a few tries. That’s why Linux offers several ways to access built-in help manuals and documentation directly from the command line. For example, when using the long listing format with the ls command, you might not recall if the correct option is -P or something else. Instead of guessing, you can instantly refer to the help text by typing:
Scrolling through the output, you can quickly locate the specific option you need (for example, the -L flag). Notice how all the command-line options are neatly sorted alphabetically and come with concise descriptions.

Viewing Help and Listing Directories

Below is an example workflow where you use the help option and then list the directory contents:
Using the --help flag is especially useful when you momentarily forget an option—even for commands featuring numerous switches.

Detailed Command Help with journalctl

For more complex commands, you may need a comprehensive explanation. Take journalctl for example, a command used to read system logs. Entering journalctl --help will provide detailed information:
When you run this command, the output is presented in a pager, allowing you to scroll through the text with the arrow keys or page up/page down, and by pressing Q, you can exit the viewer.

Accessing Manual Pages (man)

Every significant command in Linux comes with its own manual (“man”) page. To access a command’s manual, type:
This displays a brief description, a synopsis outlining the command syntax, and a detailed explanation of how the command works. For instance:
Many manual pages also conclude with practical examples. For example, the journalctl man page provides examples such as:
Use manual pages to deepen your understanding of each command’s options and usage. This practice is especially beneficial during exams or when you need a quick refresher.

Distinguishing Similar Man Pages

Sometimes, two man pages may share the same command name. For example, there is both a command and a programming function for printf. The manual categorizes these pages into sections. You can observe this by checking the man page for man itself:
The image shows a dark-themed terminal interface with the text "Manual Pages With man Command" at the top and two words, "printf" and "printf()" displayed in the center.
To view the manual page for the printf command itself, specify section 1:
For the printf function (used in programming), specify section 3:
During online exams, the Linux Foundation allows the use of both man and the --help option, so remember to utilize them if you forget a command option.
Delving into a manual page might take some time, but it is invaluable in understanding the inner workings of a command.

Using apropos to Find Commands

What if you can’t remember the name of the command you need? The apropos command searches the man page database for keywords in their short descriptions.
The image shows a dark-themed terminal interface with the word "apropos" displayed, indicating a search for commands. The top right corner has a "KodeKloud" logo.
For instance, to search for man pages related to directories, you might enter:
If you encounter an error, it might be because the mandb database hasn’t been created or updated. You can generate or update it manually with:
After updating the database, running:
will list relevant entries, such as mkdir. Keep in mind that apropos displays entries from all sections—including system calls from section 2—which may be overly advanced for everyday use. Since common commands are usually located in sections 1 and 8, you can filter the results using the -s option:
This filtering can help you quickly locate the specific command you need.

Command Auto-Completion

Another useful feature in Linux is command auto-completion. When you type a command like systemctl and press TAB, the terminal automatically completes the command. For example:
Many commands provide auto-completion suggestions for additional arguments. For instance, after entering systemctl followed by a space, pressing TAB twice might display options such as:
Note that auto-completion may not list every single option. For example, if you type:
and then press TAB, the command might auto-complete the remaining text. Auto-completion isn’t limited to commands—it also applies to file and directory names. For example:
For long filenames like wordpress_archive.tgz, you might only have to type the first few characters (e.g., wor) and press TAB to complete the name.

Hands-On Practice with man and —help

While help pages and manuals are invaluable, the initial learning curve might be steep. A good exercise is to choose a command you’re less familiar with and learn it exclusively by using man and the --help option. This method is especially useful during exams when theoretical questions may probe knowledge you may have forgotten. Proficiency in quick look-ups using manual pages can save you significant time. Consider additional command options often found in manual pages, such as those for grep:
By practicing with these manual pages, you’ll develop the skills to quickly look up details and gain a deep understanding of options—an essential ability for effective Linux system administration and for successfully passing exams.
Regularly using the man and help commands can significantly improve your proficiency, ensuring you’re well-prepared for any Linux system task or exam challenge.

Watch Video

Practice Lab