For novice users, the terminal can be a real challenge. If you are new to Linux, you will love this post because we will tell you about Ways To Get Help On The Linux Shell.
While working with the terminal, it is possible to get information about commands or a hint in case you are doing something wrong, or it is not working as expected.
1. Showing the man pages
A man page (short for manual page) is the traditional form of software documentation on a Unix-like OS like Ubuntu. Most commands have the possibility to use man to display interesting help.
The operation of the command is simple, since all we have to do is to run it together with the command you want to know.
For example,
man wget
You will see a screen where you will have a manual on how to use the command
Remember that not all commands have the possibility to use man
but many do, and it is the first way to have help in the terminal because knowing more about the command, it becomes easier to use it.
2. Option -h or –help while using the command.
If you don’t prefer the man
navigation, you can from the command itself get help on how to use it.
This option is present in almost every command you can imagine, and even in those that do not belong to UNIX. So to use it, I will take as an example the command cd
cd --help
Sample output
Note: some commands support -h
, some --help
and both some. Anyway, it is easy to check
The on-screen output, as you will notice, is quite explicit and allows you to get a more profound understanding of the command to use. This is the part where one should always start.
3. The help command
The help command, as its name suggests, is a command by which you can get help from other commands, but it has options to further simplify the output.
The syntax of the command is
help [-dms] [pattern ...]
The options are only three, but they are quite useful. The description is as follows:
-d
: This option shows a brief description about the command.-s
: If you want to know the syntax of the command, then this is the right option.-m
: Will show a page similar to man, but more reduced.
To use it, you can run something like this
help -d cd
Sample output:
cd - Change the shell working directory.
4. Get Help On The Linux Shell with the info command
The info command also shows information about the commands, but this one is focused on those hosts that do not have a man page.
info wget
Sample output
As you can see, this command is simple to use and allows you to get a lot of help on the command to use. Note that in order for this command to work, it is necessary that the tool to be analyzed has an information document in /usr/share/info
.
5. Linux apropos command
So far, you have seen how to get help on a command. However, sometimes you may not even know where to start. So, you probably need some help to know which command to use.
The apropos command searches the man-pages for a phrase you provide, so it’s a quick way to find a command that can do something.
For example,
apropos upload
Sample output
cvs-debrelease (1) - upload a cvs-buildpackage/cvs-debuild generated package
dcut (1) - Debian command upload tool for the archive upload queue
debrelease (1) - a wrapper around dupload or dput
dput (1) - Debian package upload tool
dput.cf (5) - Debian package upload tool configuration file
gist-paste (1) - upload code to https://gist.github.com
git-upload-archive (1) - Send archive back to git-archive
git-upload-pack (1) - Send objects packed back to git-fetch-pack
ltnu (1) - lists packages of a maintainer ordered by last upload
who-permits-upload (1) - look-up Debian Maintainer access control lists
who-uploads (1) - identify the uploaders of Debian source packages
This way, you can locate a command that does what you intend it to do.
6. Cheats: A utility to create interactive cheatsheets on the command-line
The community always helps the community, so a tool called cheats has been created that allows you to create cheatsheets of your most used commands.
It is written in GO, so it is very fast and consumes almost no resources and as it is a terminal interface, it can be used even on servers.
To install it, just run the following commands one by one on your computer
cd /tmp
wget https://github.com/cheat/cheat/releases/download/4.4.0/cheat-linux-amd64.gz
gunzip cheat-linux-amd64.gz
chmod +x cheat-linux-amd64
sudo mv cheat-linux-amd64 /usr/local/bin/cheat
In short, you go to the /tmp
directory, then with wget
you download the chosen version. You unzip it, assign it execution permissions and move it to a directory within the PATH.
Now, it would be enough to use it like this
cheat tar
This is an essential tool for using the terminal.
Conclusion
Help on the terminal or shell is important so that novice users can use it without fear of doing something wrong or gain more confidence. In this post, we have presented you several ways to learn more about the terminal.
I hope you liked this post, and you can share it with your friends and on all your social networks.