Skip to content

What is -h vs --help in Linux command?

-h vs --help

To sum up, the Linux shell provides access to help information for commands through both -h and —help.

However, —help is a more uniform and universal option that may be used with a variety of commands. Shorter and occasionally used, -h can have varying availability and significance.

It is advised to use --help to reliably obtain help information, particularly for commands that are unknown.

[root@rhel ~]# mkdir --help
Usage: mkdir [OPTION]... DIRECTORY...
Create the DIRECTORY(ies), if they do not already exist.

Mandatory arguments to long options are mandatory for short options too.
  -m, --mode=MODE   set file mode (as in chmod), not a=rwx - umask
  -p, --parents     no error if existing, make parent directories as needed
  -v, --verbose     print a message for each created directory
  -Z                   set SELinux security context of each created directory
                         to the default type
      --context[=CTX]  like -Z, or if CTX is specified then set the SELinux
                         or SMACK security context to CTX
      --help     display this help and exit
      --version  output version information and exit

GNU coreutils online help: <https://www.gnu.org/software/coreutils/>
Full documentation <https://www.gnu.org/software/coreutils/mkdir>
or available locally via: info '(coreutils) mkdir invocation'
[root@rhel ~]#

8 Ways To Get Help On The Linux Shell

hostname -h
hostname --help
man 
info 
apropos
whatis 
dpkg -S

Comments