Some command line interfaces or command line utilities give some comprehensive documentation or help when --help
is appended to the name of the command, for example git
:
git --help
# shows comprehensive help docs
Some others show only the command and its arguments (that's all), for example grep
:
grep --help
usage: grep [-abcDEFGHhIiJLlmnOoqRSsUVvwxZ] [-A num] [-B num] [-C[num]]
[-e pattern] [-f file] [--binary-files=value] [--color=when]
[--context[=num]] [--directories=action] [--label] [--line-buffered]
[--null] [pattern] [file ...]
And others give some assistance, but only because --help
is not recognised as a legal option, for examples ls
:
ls --help
ls: illegal option -- -
usage: ls [-@ABCFGHLOPRSTUWabcdefghiklmnopqrstuwx1%] [file ...]
and netstat
:
netstat --help
netstat: illegal option -- -
Usage: netstat [-AaLlnW] [-f address_family | -p protocol]
netstat [-gilns] [-f address_family]
netstat -i | -I interface [-w wait] [-abdgRtS]
netstat -s [-s] [-f address_family | -p protocol] [-w wait]
netstat -i | -I interface -s [-f address_family | -p protocol]
netstat -m [-m]
netstat -r [-Aaln] [-f address_family]
netstat -rs [-s]
Question
Are there any generally safe way(s) of getting documentation or help with a CLI or utility without having to google (i.e. from within the terminal)? I currently try --help
or -h
, but other than that I go straight to google, but would like to know if there are other things to (safely) try before going to google.
man
command. For example:man ls
orman grep
. You can get comprehensive documentation onman
by enteringman man
.git
,grep
,ls
,netstat
) and it works for all of these different CLI's/utilities. I didn't anticipate that it would be that straight forward. Thanks againOpen man page
.