In this article, we will see how to get help with a command in linux. No one can ever learn all commands of linux/UNIX, it is always suggested that you should know how to run a command in linux and for this we should know how to view help, syntax, or man pages in linux.
In Linux/UNIX, we have many command to check for help or to know how to use a command. Let us look at these ways.
1. Man Page of a command
To view the manual page for command help, just run command name followed by keryword "man". For example:
-bash-3.2$man dateDATE(1) User Commands DATE(1)NAME date - print or set the system date and timeSYNOPSIS date [OPTION]... [+FORMAT] date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]]DESCRIPTION Display the current time in the given FORMAT, or set the system date.2. Info Command
The other way to know more about command, we can use "info" command. For example:
-bash-3.2$ info dateFile: coreutils.info, Node: date invocation, Next: uname invocation, Up: System context21.1 `date': Print or set system date and time==============================================Synopses: date [OPTION]... [+FORMAT] date [-u|--utc|--universal] [ MMDDhhmm[[CC]YY][.ss] ] Invoking `date' with no FORMAT argument is equivalent to invoking itwith a default format that depends on the `LC_TIME' locale category.In the default C locale, this format is `'+%a %b %e %H:%M:%S %Z %Y'',so the output looks like `Thu Mar 3 13:47:51 PST 2005'.3. --help or -h argument.
"--help" argument displays help of the command syntax and it helps us to get the correct syntax of the command. Let us look at an example:
-bash-3.2$ date -hdate: invalid option -- hTry `date --help' for more information.-bash-3.2$ date --helpUsage: date [OPTION]... [+FORMAT] or: date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]]Display the current time in the given FORMAT, or set the system date. -d, --date=STRING display time described by STRING, not `now' -f, --file=DATEFILE like --date once for each line of DATEFILE -r, --reference=FILE display the last modification time of FILE -R, --rfc-2822 output date and time in RFC 2822 format --rfc-3339=TIMESPEC output date and time in RFC 3339 format. TIMESPEC=`date', `seconds', or `ns' for date and time to theNow suppose you forget the command but you know that you want command related to term "raid" to configure raid on your computer. So we can search our man pages containing this term "raid".
So there are two arguments with man command "-k" or "-K" i.e. in small case and in upper case. Both help us to get the required man page.
-bash-3.2$ man -K date/usr/kerberos/man/man8/ftpd.8.gz? [ynq] n/usr/kerberos/man/man8/telnetd.8.gz? [ynq] n/usr/kerberos/man/man8/klogind.8.gz? [ynq] n/usr/kerberos/man/man8/kadmin.8.gz? [ynq] n/usr/kerberos/man/man8/kshd.8.gz? [ynq]-bash-3.2$ man -k date/etc/updatedb.conf [updatedb] (5) - a configuration file for updatedb(8)APR::Date (3pm) - Perl API for APR date manipulating functionsBN_BLINDING_update [BN_BLINDING_new] (3ssl) - blinding related BIGNUM functionsEVP_CipherUpdate [EVP_EncryptInit] (3ssl) - EVP cipher routinesEVP_DecryptUpdate [EVP_EncryptInit] (3ssl) - EVP cipher routinesEVP_DigestUpdate [EVP_DigestInit] (3ssl) - EVP digest routinesEVP_EncryptUpdate [EVP_EncryptInit] (3ssl) - EVP cipher routinesEVP_OpenUpdate [EVP_OpenInit] (3ssl) - EVP envelope decryptionEVP_SealUpdate [EVP_SealInit] (3ssl) - EVP envelope encryptionEVP_SignUpdate [EVP_SignInit] (3ssl) - EVP signing functionsEVP_VerifyUpdate [EVP_VerifyInit] (3ssl) - So now you can easily work in linux and can able to find the help. Manual pages help a lot and you will later realise that these are very useful and you should make a habit to refer them for various argument/options provided by these.