How to Get Help in Linux: man, info, --help and Online Documentation
Getting help in Linux is very easy. Linux has a set of manuals that can be used by users and administrators to look up information about commands in search of help.
Linux has some user help channels, such as:
- Command help with the "--help" option;
- Information pages with the "info" command;
- System documentation in "/usr/share/doc";
- Manuals through the "man" command;
Command Help
Most commands have a small help via the "--help" option, which shows a small manual:
$ free --helpUsage: free [options]Options: -b, --bytes show output in bytes -k, --kilo show output in kilobytes -m, --mega show output in megabytes -g, --giga show output in gigabytes --tera show output in terabytes --peta show output in petabytes -h, --human show human-readable output --si use powers of 1000 not 1024 -l, --lohi show detailed low and high memory statistics -t, --total show total for RAM + swap -s N, --seconds N repeat printing every N seconds -c N, --count N repeat printing N times, then exit -w, --wide wide output --help display this help and exit -V, --version output version information and exit
Using Info Pages
An interesting source of reference are the info pages. This documentation was developed by the GNU project and covers most of the project's tools.
To access this documentation, you need to use the info command followed by the name of the desired command. See an example, typing the command in the shell:
# info test
Info allows navigation between related topics. To navigate in info, just find a "link" which is formed by the "*" symbol and a word and press enter.
To go to the next page of content, type "N" (Next) and to go back, type "P" (Previous). The "q" key exits info.
The info command without any arguments lists all existing pages.
# info
Finding Documentation in /usr/share/doc
The /usr/share/doc directory contains most of the documentation of a Linux distribution and various applications in the form of HOWTOs, FAQs, README files, installation guides and user manuals.
The /usr/share/doc/howto subdirectory has almost 2000 pages of documentation detailing step by step various tasks.
See an example:
3Dfx-HOWTO.htmlAI-Alife-HOWTO.htmlAcer-Laptop-HOWTO.htmlAlpha-HOWTO.htmlBash-Prog-Intro-HOWTO.htmlBenchmarking-HOWTO.html
This type of documentation is useful when you don't know how to start a certain task or which tools should be used.
In the /usr/share/doc/packages subdirectory you can find information about almost all software packages installed on the system. This information may include files with different contents such as README, INSTALL, CHANGES, INFO, FAQ, etc.
HOWTOs are not always installed in the distribution, and their path may be different.
Command Manual with man
$ man [section] command
The man command offers a manual for various GNU Linux commands, as well as manuals for other third-party programs. Man offers a simplified interface for programmers to provide a manual for their programs.
Manual pages come with almost all GNU/Linux programs and can be installed according to the chosen language, if available in the distribution.
The man information is called "Man Pages" and they bring a basic description of commands and details about how their options work.
A manual page is displayed as single text with vertical scrolling. It also documents parameters used in some configuration files.
Man Sessions
Manual documents are divided into sessions according to the subject covered. The sessions are numbered from 1 to 9, as follows:
- Executable programs or shell commands;
- System calls (functions provided by the Kernel);
- Library calls (functions provided by the libraries);
- Special files, especially those located in /dev;
- File formats and conventions;
- Games;
- Macro packages;
- Administrative commands;
- Kernel routines.
It is possible that the same word may reference a programming function, command or configuration file. This way it is important to know in which session we will find the desired documentation.
Each manual page is divided into parts:
- NAME: Name of the searched item with a short description;
- SYNOPSIS: Complete description of usage and syntax;
- DESCRIPTION: Brief description of functionalities;
- OPTIONS: Description of each option and arguments;
- FILES: A list of important files;
- SEE ALSO: A list of items related to the searched one;
- BUGS: Description of possible problems with the item;
- AUTHOR: List of people responsible for the item.
To access the manual, the command is man followed by the searched item. Optionally, the section number can be passed as a parameter.
$ man passwd
In this example man displays the manual for the passwd command, belonging to section 1.
$ man 5 passwd
In this example man will display the manual for the /etc/passwd file.
Navigation within manual pages is done using the keys:
- q Exits the manual page;
- PageDown or f Scrolls 25 lines down;
- PageUP or w Scrolls 25 lines up;
- UpArrow or k Scrolls 1 line up;
- DownArrow or e Scrolls 1 line down;
- r Redraws the screen (refresh);
- p or g Beginning of the page;
- h Help about the manual page options;
- s Saves the manual page in text format to the specified file.
Conclusion
If you want to get help with any command in Linux, the easiest way is to use the "man" command to read the manual for the desired command.
Learn much more about Linux in our online course. You can enroll here. If you already have an account, or want to create one, just log in or create your user here.
Liked it? Share
That was just one piece. The course teaches the whole path — from your first command to exam day.