5 ways to get command help in linux/unix
When we use commands in the linux/unix shell, we often need to check what capabilities the command can support and what command options are available.
At this time, we hope to get more help information about this command.
How to get help while working on Shell ?
The following lists how to get help from the mac os terminal command line:
Use the command options –h or –help
When we do not know how to use the command, do not know the command options and return type, etc., we can use the -h
or -help
command.
- Start the terminal
- Type the command that needs help, type -h or -help after it, and then press Enter.
You will get the complete usage of the command as shown below.
$ vim --help
# OR
$ vim -h

This method is not recommended. Because some commands are no longer built-in -h or -help as help options.
Use man command or man pages
The man command can help us get a detailed manual of the command.
- Start terminal
- Type the
man
command followed by the command that needs help, and then press Enter.
$ man vim

Use the help command
The help command can only get the help manuals of all the commands pre-installed in the system.
- Start terminal
- Type the
help
command followed by the command that needs help, and then press Enter.
$ help cd

Use the info command
Some commands do not have a manual or the manual is incomplete. To get help on these commands at this time, we use the info command.
- Start terminal
- Type the
info
command followed by the command that needs help, and then press Enter.
$ info vim

Use whatis command
The whatis command can quickly understand the command usage without reading the entire manual.
- Start terminal
- Type the
whatis
command followed by the command that needs help, and then press Enter.
$ whatis vim
