Do you know what dmidecode command will do?
Ans : Are you going to search in G0ogle about dmidecode? No need to search for it. No need to go any where. Linux provide many help tools to make you familiar with any command. This post is all about these commands/options and they are as follows.

  1. info command
  2. man command
  3. whatis command
  4. whereis command
  5. which command
  6. help command
  7. –help option
  8. –usage option

1. info command in Linux/unix

The info command will give a detailed information

Example :

info ls

The above command will show full help about ls command which is of 10 pages. This will give full information.

2. man command(manual command) in Linux

This will give little bit less descriptive but will provide information which you require, and most of the times each option of a command will be described in one sentence and some times in paragraphs.

Example :

man ls

Suppose if you want to see multiple commands you can just append commands to man command.

Example:

man ls pwd whomai

To exit from first command press “q” without quotes. And continue to next command and repeat “q” to read next command help.

3. whatis command

in Linux

This will show one line description to a give command. This is similar to “man -k ls”

whatis ls

Ouput:

surendra@sanne-taggle:~$ whatis ls
ls (1) - list directory contents
LS (6) - display animations aimed to correct users who accidentally enter LS instead of ls .

This command to support multiple commands to append to it.

whatis ls pwd whoami

Output:

surendra@sanne-taggle:~$ whatis ls pwd whoami
ls (1) - list directory contents
LS (6) - display animations aimed to correct users who accidentally enter LS instead of ls .
pwd (1) - print name of current/working directory
whoami (1) - print effective userid

4. whereis command

This is not a help command but I feel describing this here. This command will show the location of any command and it’s man page location as well.

whereis ls

Output:

surendra@sanne-taggle:~$ whereis ls
ls: /bin/ls /usr/share/man/man1/ls.1.gz

Even this command to support multiple commands to append to it.

Output:

surendra@sanne-taggle:~$ whereis ls pwd whoami
ls: /bin/ls /usr/share/man/man1/ls.1.gz
pwd: /bin/pwd /usr/include/pwd.h /usr/share/man/man1/pwd.1.gz
whoami: /usr/bin/whoami /usr/share/man/man1/whoami.1.gz

5. Which command

This is one more command which will give you just location of the command.

which ls

Output:

surendra@sanne-taggle:~$ which ls
/bin/ls

Even this command too supports multiple commands to append.

Example:

surendra@sanne-taggle:~$ which ls pwd whoami
/bin/ls
/bin/pwd
/usr/bin/whoami

6. The help command in Linux

Some times you try to find out info on some commands such cd, pwd etc. But you will see many commands  at that time. This is due to the inbuilt commands. So with man, info etc commands you can not get much information about the inbuilt commands. If you want to know what an inbuilt command do, you have to use help command.

help let

Output:

surendra@sanne-taggle:~$ help pwd
pwd: pwd [-LP]
 Print the name of the current working directory.
 
 Options:
 -L print the value of $PWD if it names the current working
 directory
 -P print the physical directory, without any symbolic links
 
 By default, `pwd' behaves as if `-L' were specified.
 
 Exit Status:
 Returns 0 unless an invalid option is given or the current directory
 cannot be read.

Even this command to appending stuff

Example:

surendra@sanne-taggle:~$ help while for if
while: while COMMANDS; do COMMANDS; done
 Execute commands as long as a test succeeds.
 
 Expand and execute COMMANDS as long as the final command in the
 `while' COMMANDS has an exit status of zero.
 
 Exit Status:
 Returns the status of the last command executed.
for: for NAME [in WORDS ... ] ; do COMMANDS; done
 Execute commands for each member in a list.
 
 The `for' loop executes a sequence of commands for each member in a
 list of items. If `in WORDS ...;' is not present, then `in "$@"' is
 assumed. For each element in WORDS, NAME is set to that element, and
 the COMMANDS are executed.
 
 Exit Status:
 Returns the status of the last command executed.
if: if COMMANDS; then COMMANDS; [ elif COMMANDS; then COMMANDS; ]... [ else COMMANDS; ] fi
 Execute commands based on conditional.
 
 The `if COMMANDS' list is executed. If it's exit status is zero, then the
 `then COMMANDS' list is executed. Otherwise, each `elif COMMANDS' list is
 executed in turn, and if it's exit status is zero, the corresponding
 `then COMMANDS' list is executed and the if command completes. Otherwise,
 the `else COMMANDS' list is executed, if present. The exit status of the
 entire construct is the exit status of the last command executed, or zero
 if no condition tested true.
 
 Exit Status:
 Returns the status of the last command executed.

7. –help option with each command

This option is to give one line discription to each option of the command

Example :

passwd --help

Output:

surendra@sanne-taggle:~$ passwd --help
Usage: passwd [options] [LOGIN]
Options:
 -a, --all report password status on all accounts
 -d, --delete delete the password for the named account
 -e, --expire force expire the password for the named account
 -h, --help display this help message and exit
 -k, --keep-tokens change password only if expired
 -i, --inactive INACTIVE set password inactive after expiration
 to INACTIVE
 -l, --lock lock the password of the named account
 -n, --mindays MIN_DAYS set minimum number of days before password
 change to MIN_DAYS
 -q, --quiet quiet mode
 -r, --repository REPOSITORY change password in REPOSITORY repository
 -R, --root CHROOT_DIR directory to chroot into
 -S, --status report password status on the named account
 -u, --unlock unlock the password of the named account
 -w, --warndays WARN_DAYS set expiration warning days to WARN_DAYS
 -x, --maxdays MAX_DAYS set maximum number of days before password
 change to MAX_DAYS

8. –usage option with each command in Linux

This is similar to –help option available for most of the linux command.

Example:

surendra@sanne-taggle:~$ man --usage
Usage: man [-dDfkKlwWciIau7tZ?V] [-C FILE] [-R ENCODING] [-L LOCALE]
 [-m SYSTEM] [-M PATH] [-S LIST] [-s LIST] [-e EXTENSION]
 [-P PAGER] [-r STRING] [-E ENCODING] [-p STRING] [-T[DEVICE]]
 [-H[BROWSER]] [-X[RESOLUTION]] [--config-file=FILE] [--debug]
 [--default] [--warnings[=WARNINGS]] [--whatis] [--apropos]
 [--global-apropos] [--local-file] [--where] [--path] [--location]
 [--where-cat] [--location-cat] [--catman] [--recode=ENCODING]
 [--locale=LOCALE] [--systems=SYSTEM] [--manpath=PATH]
 [--sections=LIST] [--extension=EXTENSION] [--ignore-case]
 [--match-case] [--regex] [--wildcard] [--names-only] [--all]
 [--update] [--no-subpages] [--pager=PAGER] [--prompt=STRING]
 [--ascii] [--encoding=ENCODING] [--no-hyphenation] [--nh]
 [--no-justification] [--nj] [--preprocessor=STRING] [--troff]
 [--troff-device[=DEVICE]] [--html[=BROWSER]]
 [--gxditview[=RESOLUTION]] [--ditroff] [--help] [--usage]
 [--version] [SECTION] PAGE...

Please remember –help or –usage may not work with some commands.

The following two tabs change content below.
Mr Surendra Anne is from Vijayawada, Andhra Pradesh, India. He is a Linux/Open source supporter who believes in Hard work, A down to earth person, Likes to share knowledge with others, Loves dogs, Likes photography. He works as Devops Engineer with Taggle systems, an IOT automatic water metering company, Sydney . You can contact him at surendra (@) linuxnix dot com.