Before heading to Google to get help on a particular Unix command, try the following methods, which will give you a comprehensive help on Unix commands.
1. Using apropos to search man pages
Use apropos to search man pages for available Unix commands on a specific functionality.
$ apropos -r REGEXofUNIXCOMMAND or Description.
About apropos command from the man page:
apropos searches a set of database files containing short descriptions of system commands for keywords and displays the result on the standard output.
Following example displays all the available grep related commands using apropos.
$ apropos grep bzegrep (1) - search possibly bzip2 compressed files for a regular expression bzfgrep (1) - search possibly bzip2 compressed files for a regular expression bzgrep (1) - search possibly bzip2 compressed files for a regular expression egrep (1) - print lines matching a pattern fgrep (1) - print lines matching a pattern grep (1) - print lines matching a pattern pgrep (1) - look up or signal processes based on name and other attributes rgrep (1) - print lines matching a pattern zegrep (1) - search possibly compressed files for a regular expression zfgrep (1) - search possibly compressed files for a regular expression zgrep (1) - search possibly compressed files for a regular expression zipgrep (1) - search files in a ZIP archive for lines matching a pattern
2. Read man page of the command
This is the easy and most effective method to get quick help on any Unix command. I’ve seen lot of people (especially newbies) getting bored reading the man pages.
While Unix man pages might not have lot of practical examples, it does explain all the options available for a command in a detailed manner.
$ man UNIXCOMMAND $ man tar
If you don’t know the exact command name for a specific functionality, use man -k option to locate the command.
The below example lists all the available commands that has the word “compression” in the description.
$ man -k REGEX or UNIXCOMMAND $ man -k compression bzip2 (rpm) - A file compression utility. gzip (rpm) - The GNU data compression program. zip (rpm) - A file compression and packaging utility compatible with PKZIP. zlib (3) - compression/decompression library zlib (rpm) - The zlib compression and decompression library.
3. Display Single Line Description About a Unix Command
To display a single line description about the command, you can use whatis command.
$ whatis UNIXCOMMAND
About whatis command from the man page:
whatis searches a set of database files containing short descriptions of system commands for keywords and displays the result on the standard output. Only complete word matches are displayed.
The following example displays high level single line information about the cron command.
$ whatis cron cron (8) - daemon to execute scheduled commands (Vixie Cron)
4. Use -h or –help option of the command itself
Sometimes you may know the functionality of a command very well, but cannot recollect all the available options for a specific command. Use -h option of the command to review all available options of the command.
$ UNIXCOMMAND -h
Following example will display a quick help on netstat command
$ netstat -h
5. Read Info Documents using Unix info Command
When you are not able to find the required information from the Unix man page, try the info documents using the Unix info command as shown below.
$ info UNIXCOMMAND $ info sed
Finally, we have 200+ high quality Linux articles written so far. You may find what you are looking for in one of those article.
Comments on this entry are closed.
Thanks mate for posting this. Helpful!