For new Linux users, it can be challenging to understand commands and their functions. The Linux command whatis provides a brief description of commands, helping users quickly grasp their purpose. With numerous commands in Linux, running whatis on an unfamiliar command gives you a concise explanation. Let’s explore how to use this command effectively.
Table of Contents
What is the Linux command whatis?
The whatis command in Linux is designed to provide a short, concise description of other commands. It extracts this information from the system’s manual pages (man pages) and displays it for the user. The information provided is brief, allowing users to quickly understand what a command does.
Simply put, the whatis command answers the question: “What does this command do?” For instance, if you want to know what the ls
command does, you can simply enter whatis ls
.
Basic Usage of whatis
The basic usage of the whatis command is very simple. In the terminal, you can enter it in the following format:
whatis [command]
ShellScriptHere, [command]
is the Linux command for which you want to retrieve information. For example, to get a brief description of the whatis command itself, you can enter:
whatis whatis
ShellScriptThe output will look like this:
As shown in the output, the whatis command provides a single-line description from the manual page. The number in parentheses, (1), indicates that this command belongs to the first section of the Linux manual pages. The Linux manual pages are divided into nine sections, each covering different topics, such as commands, system calls, and library functions.
Searching Multiple Commands Simultaneously
The whatis command also allows you to retrieve information about multiple commands at once. To do this, simply separate the commands with spaces.
whatis [명령어1] [명령어2] [명령어3]
ShellScriptFor instance, you can search for the descriptions of the ls
, rm
, and pwd
commands simultaneously, and the results will be displayed all at once:
Updating the whatis Database
Sometimes when you run the whatis command, no results may appear, or you might encounter a message saying “nothing appropriate.” This can happen if the system’s whatis database hasn’t been updated. In this case, you can manually update the database using the mandb
command:
sudo mandb
ShellScriptAfter running this command, the manual page database will be updated, and you should be able to retrieve results when using the whatis command.
Important Notes for Searching Commands
One important thing to keep in mind when using the whatis command is that the input must exactly match the command you’re looking for. If you enter a command that doesn’t exist, you’ll receive a message like “nothing appropriate.”
Additional Tip: The Related Command man
While the whatis command provides a brief description, the man command offers more detailed information. If you want to learn more about a specific command, it’s a good idea to use the whatis command for a quick overview and then use the man command to view the full manual.
man [명령어]
ShellScriptFor example, if you want to learn more about the ls
command, you can enter:
man ls
ShellScriptThe result will give you a detailed explanation of the command along with its options.
Summary
While using Linux, it’s easy to forget or come across new commands. In such cases, the Linux command whatis is a handy tool that quickly provides a description of what a specific command does. It is especially useful for beginners who are still learning the commands, as well as for advanced users who may need a quick reminder.
Additionally, combining the whatis command with the man command can significantly improve your understanding of Linux commands, making you more efficient in your system management tasks.