There are hundreds of Linux commands, and remembering all of them is absolutely impossible. Besides, it is not necessary though. At times, my mind goes completely blank and I couldn't remember a particular command. I keep looking at the Terminal and try to remember the command, but can't. If you are anything like me, I've got a good news for you. Thanks to Apropos command and BASH history, it is very easy to recall forgotten Linux commands.
Apropos is a Linux command that searches the manual page names and descriptions by using a given keyword or string. It comes pre-installed in most Linux distributions.
Easily Recall Forgotten Linux Commands Using Apropos
Let say you forgot the command to list the contents of a directory. Let us see if apropos can help us in this regard.
$ apropos "list directory"
Sample output:
See? The apropos command displays the list of suggested commands that matches for the given search string. As you see in the example, we can use "dir" command to list a directory contents.
I know it is easy to remember "dir" command, but I have used it here to demonstrate the purpose of Apropos command. You can use any search string. But, some times you need to be more specific when using search strings. For example, the following command will display all commands that contains the word "list".
$ apropos "list"
In such cases, apropos will not help you to find what you're looking for.
Let me show you another example. Want to find the Linux Kernel details, but you forgot the actual command? Here is how you can find it out.
$ apropos "kernel"
Or, run it without quotes:
$ apropos kernel
In this case, we can use "uname" command to know the details of Linux Kernel.
Please note that you must use quotes when the search string has more than one word.
I forgot the command to access my remote system? What to do? No worries! Use the following command to find out what it is!!
$ apropos "remote"
Be mindful that the Apropos command will display all possible commands that has the search string in their description. So, you might have to scroll through the results and pick the command that suits you.
For more details, refer man pages.
$ man apropos
OK, I forgot some lengthy commands that I used few days ago, how to remember them?
No problem. I know a few ways to remember the forgotten Linux commands.
Do a quick reverse search by pressing "CTRL+R" and type the first few letters of the command you're looking for. You will see the list of suggested commands from the bash history. Use UP/DOWN arrow keys to navigate through commands. Once you find out the actual command, press TAB or right arrow key to choose that command and press ENTER key to execute.
Alternatively, you can save or bookmark or apply tags to the important and frequently used commands, so you can use them later without having to search on websites or man pages. Refer the following links for more details.
3 comments
I use ‘TLDR pages’ which is a simplified man pages with examples. Apropos is also good.
I have a different approach. Many times just knowing a command is not enough. We need more context. Cheatsheets can help, but are not enough, so I decided to take a different approach:
https://singlepagebookproject.github.io/IT_notes/
https://singlepagebookproject.github.io/IT_notes/DevOps/linux_administration_summary.html
Pull-request from brave software and admin warriors are welcome!
Appreciate your work. I will look into it. Thanks.