How do I get help for "echo" or other bash commands?
Solution 1:
Assuming you are using bash, echo
is a shell builtin (which you can see by running type echo
). That means the man-page you want to read is man bash
. Or you can get help on bash builtins and keywords with the help
builtin, e.g. help echo
.
The information you see when you run man echo
, is for the external echo
command, installed by GNU coreutils. (type -a echo
).
To learn bash, read http://mywiki.wooledge.org/BashGuide
Solution 2:
There are two echo
The built-in command and another one, an executable placed in /bin/echo
The built-in (this is the default one) hasn't any help options far beyond the help echo
built-in. Any flags placed and not listed there are presented as command result and there's no help command.
In the executable version instead /bin/echo
there's a --help
flag which prints usage. but you must call /bin/echo
explicit.
Solution 3:
Other way would be using whatis bash command for example.
whatis echo >>>> shows as following
echo (1) - display a line of text
According to Whatis manpage , it displays manual page descriptions. Such as
whatis whatis
whatis (1) - display manual page descriptions
For Commands brief parameters or options try --usage
infront of them as
whatis --usage
Usage: whatis [-dvrwl?V] [-C FILE] [-L LOCALE] [-m SYSTEM] [-M PATH] [-s LIST]
[--debug] [--verbose] [--regex] [--wildcard] [--long]
[--config-file=FILE] [--locale=LOCALE] [--systems=SYSTEM]
[--manpath=PATH] [--sections=LIST] [--section=LIST] [--help]
[--usage] [--version] KEYWORD...
Another excellent source is Ubuntu Manuals a.k.a manpage, just type to search what you want.
A suggestion if you try whatis in terminal and press Tab key successfully it will show
Display all 9747 possibilities? (y or n)
You can experiment depending on above possibilities.
Also there is apropos similar to man -k keyword
use to search the manual page names and descriptions.
You can also use whereis to locate the binary, source, and manual page files of a command as
whatis whereis
whereis (1) - locate the binary, source, and manual page files for a command
Official references
You can refer this Extensive and excellent source at Ubuntu Command Line Wiki page such as [7. Beginners/BashScripting].
Refer GNU Shell Built-in Commands guide
For External Source refer
An A-Z Index of the Bash command line for Linux explaining examples and Usage .
O'reilly Linux Command Directory from Linux in a Nutshell, 5th Edition book