7 Ways To Get Command Line Help On Linux
7 Ways To Get Command Line Help On Linux
Apropos
will list several commands that match the keyword you used. The list includes a short description of what the
command does. From the output below, the highlighted command is what you are looking for to copy files or
directories.
The word apropos is derived from the French word "à propos" which means "about."
$ apropos mv
The apropos command works by looking through the entire description sections of the man pages for the
matching keyword you provide with the apropos command
2. Man
The sections may vary depending on the author of the man pages but here are some of the most common
sections that you will come across.
Name: The name of the command whose manual documents you are looking at.
Synopsis: Give a brief description of some of the options for the command in question.
Description: A more detailed description of the command including how it works, and what it does.
Options: This section describes in detail all the arguments or options you can use with the command.
Examples (Tips): This section shows you a few use cases and how the command can be used.
$ man ls
The man pages can be pretty long. To easily navigate the man pages without leaving the keyboard, you can use
the f key to go forward and the b key to go backward.
You can also search for keywords within the man pages by using the /[keyword] followed by pressing the enter
button.
Use the n key on your keyboard to navigate forward in the search and the Shift + n key to search backward.
3. Whatis
$ whatis cat
4. Info
Like the man pages, the info pages also give you a detailed description of a specific command. In some cases,
the info pages contain more details than the man pages.
The info utility provides you with the ability to read the documentation in Info format.
5 . Which
But in case you want to find out where the executable of a particular command resides, you can use the which
command. The command works by searching all paths for the executable files matching the command keyword
that you are looking for. For example, to find out where the SSH utility resides, you can run the following
command.
$ which ssh
6. Help
Another useful utility for getting help on the command-line is the help command. Use it to get a brief
description of a specific built-in command.
Here is sample output from the Help command. Note: Only built-in commands can be used with the help
command.
$ cp --help
7. Recalling Commands
The Linux terminal allows you to list commands that you have run earlier. Use the history command to show a
list of previously run commands.
$ history
It lists all commands in chronological order from the oldest to the latest with a corresponding number.
o re-run a command from the history list simply type ! followed by the number of the command. For example
to re-run the command number 9 in the list.
$ !9
Another way to recall commands is to use the Ctrl + R keyboard shortcut within the terminal window then
enter the keyword you are looking for. You can then use the CTRL + R to cycle through all previously run
commands containing the keyword you provided.