Getting help
The Linux command line offers a wealth of power and opportunity. However, it might be hard to remember a large number of details. Fortunately for us there is an easy to use resource that can inform us about all the great things we can do on the command line.
Manual pages
The manual pages are a set of pages that explain every command available on your system including what they do, the specifics of how you run them and what command line arguments they accept. Some of them are a little hard to get your head around but they are fairly consistent in their structure so once you get the hang of it it’s not too bad.
To open manual page for ls
command, you type man ls
.
Terminal
$ man ls
This command will turn your terminal into a page with a description of the ls
command and its options.
Terminal
LS(1)
NAME
ls - list directory content
SYNOPSYS
ls [OPTION]... [FILE]...
DESCRIPTION
List information about the FILEs (the current directory by default). Sort entries alphabetically if none of -cftuvSUX nor --sort is specified.
Mandatory arguments to long options are mandatory for short options too.
-a, --all
do not ignore entries starting with .
-A, --almost-all
do not list implied . and ..
-l
use a long listing format
-r, --reverse
reverse order while sorting
-t
sort by modification time, newest first
...
To navigate through the man pages, you may use ↑
and ↓
to move line-by-line, or try B
and Spacebar
to skip up and down by a full page. To search for a character or word in the man
pages, use /
followed by the character or word you are searching for. Sometimes a search will result in multiple hits. If so, you can move between hits using N
(for moving forward) and Shift+N
(for moving backward).
To quit the man pages, press Q
.
– – help
Another option, how to find out how to use a command and what options it accepts, is to pass a --help
option to the command. It will print message similar to man page.
Terminal
$ ls --help
Usage: ls [OPTION]... [FILE]...
List information about the FILEs (the current directory by default).
Sort entries alphabetically if neither -cftuvSUX nor --sort is specified.
Mandatory arguments to long options are mandatory for short options, too.
-a, --all do not ignore entries starting with .
-A, --almost-all do not list implied . and ..
--author with -l, print the author of each file
...
The Internet
Of course, there is a third way to access help for commands: searching the internet via your web browser. When using internet search, including the phrase unix man page
in your search query will help to find relevant results.
Previous page | Home | Next page |