The capability to memorize more information is not a measure for efficiency. The real efficiency is to know how and where you could get info when you need it. (That is why exams nowadays are commonly open book). As a Linux admin, you can’t possibly remember each command with each available option, no matter how many years of experience you have. Again, it would be much better to be able to get help on a command when you need to use it. Obtaining help on Linux commands is the subject of this article. Have a nice reading.
Obtaining Help on Linux Commands
Red Hat Linux comes with over hundreds of commands. Fortunately, Linux is nice enough to provide numerous tools to obtain the necessary help on commands’ usage, with different levels of details. The following sections discuss those tools.
The whatis Database
Red Hat maintains a database of short descriptions for the system commands. To create the whatis database, execute the system command /usr/sbin/makewhatis.
- To obtain info on the ls command, use the command: whatis ls
- To prepare the whatis database:
- To get short information on the fdisk command:
Using –help Option
The –help option prints the usage message and basic syntax for a command, then exits to the shell.
To locate the full path of an executable shell command, use the which command.
which COMMAND …
Displaying a Command’s Online Manual Page
A manual page for a command provides:
- Short description of the command function.
- The command syntax.
- A detailed description for the command function.
- The list of available options with their effects on the command behavior.
- The command Exit Status (code) in cases of success and failures.
To exit the manual page, press q.
Searching for Commands Matching a Specific Keyword
If you don’t know the command that achieves a specific function, the man command can help you search for it using a keyword.
man –k KEYWORD
I need to know if there is a command that pauses or delays the shell a given number of seconds.
Let’s try looking for it using the keyword “delay”.
The search output gives three recommended commands whose the short description of each has the word “delay”. Of the three commands, the sleep command looks the closest to our concern.
Using the info Documents
The info command provides a more detailed help on commands.
To display the info page for the sleep command, enter the command info sleep.
In this article, we have discussed how you can get help on Red Hat Linux commands.
- The whatis command gives a short description for a given command.
- The which command locates the full path for a given command.
- The –help option prints the usage message and basic syntax for a command, then exits to the shell.
- The man command opens the manual page for a command.
- To search for a command using a keyword, use man with –k
- The info command opens the info document for a given command.
In the next article, we will talk about the vim editor; See you there!