From this article, we will learn how to get help from Linux. If you are a beginner or an inexperienced person, you wouldn’t have an idea about what are these commands, what will they do ? what is the right command i need for getting my work done ? Like that.
So, in Linux terminal you can have several ways to get it’s help. It’s very very useful. As a beginner using those tools is good to get a better start. We will check them one by one.
1) Using man command
syntax : man <command>
These are man pages like a manual page for each an every command. Using man page is the best way to get help from Linux. Because man pages gives you a full detail page about the command and it is having all the options you can use. Sometimes man pages will give you examples also how to use them. I prefer using man pages is more relevant for a beginner to get to know about the commands.
eg – man ls
In a case like if you don’t know what the exact command, but you have an idea what to do. Then you can search the man pages for a keyword like below.
syntax : man -k <keyword>
You need to find the command to copy a file. Then you can use the keyword string as “copy”. So you could use man -k copy
There you can find what is the command useful for your task. If you want to do a file copy to a directory, you can use cp command.
So, man -k <keyword> searches the keyword in man pages database and displays that matches for your request.
If you want to do a deep search, you can use man -K <keyword>. What this command doing is it reads all the man pages, content and displays all the pages that include your keyword.
2) Using –help command
syntax : <command> –help
eg : ls –help
I used here ls –help | less in order to view the page from the beginning. Otherwise it will show the end of the page as it is a large file.
* If you use –help, you need to know the command exactly. But in man command you can find with a keyword. That will be a plus point for using man commands.
3) Using the Tab Completion
If you can’t remember the full name of a command or a path, but assume you know first or first two letters of the command or the path. Then you can get suggestions by double tapping Tab in your keyboard.
i) for a path, Assume there is a directory named “Documents” in you home directory. But you can’t remember the it’s name. You can do like below.
It types only letter ‘D’ and press double tab. Then you can have list of suggestions. The output changes with your input letters. But If you gave “Doc”, the search results will be shown as below.
It matches the files with your input characters.
ii) for a command, suppose you need to know your virtual machine’s host name. You type only host and press double tab. It will show the suggestions.
You can find the hostname command.
4) Using info command
syntax : info <command>
info is also a tool we can get help from Linux.
eg : info ls
Usefull resources –