Monday, September 17, 2012

Linux whatis command

Linux and the Linux commands have a long history. Some of the commands currently used within the mainstream Linux originate from the first UNIX (like) systems. Also the nature of Linux being opensource adds to the list of commands and utilities that are added to the Linux distributions. This makes it sometimes hard to keep track of commands that you do not use every day. The most common commands you use for your day to day work you probably know by hart however every now and then you would like to know an answer the question "what is this command". For this very purpose the whatis command is added to most of the Linux distributions. This is exactly doing what the command indicates by its name.

The average man page has the following parts associated to it:
  • Name
  • Synopsis
  • Description
  • Author
  • See also
When you look into the man page all this information is send to your screen while you simply want to know what this command is. For example if you query the man page of the ls command you will get something like this (and more)

       ls - list directory contents

       ls [OPTION]... [FILE]...

       List information about the FILEs (the current directory by default).  Sort entries alphabetically if none of -cftuvSUX nor --sort is specified.

       Mandatory arguments to long options are mandatory for short options too.

       -a, --all
              do not ignore entries starting with .

       -A, --almost-all
              do not list implied . and ..

              with -l, print the author of each file

       -b, --escape
              print C-style escapes for nongraphic characters

In some cases this is way to much information and you would be happy with only the part that is in the name section because this is giving you more than enought information. If you do a whatis ls command you will get the following:

johan@linux-main:~$ whatis ls
ls (1)               - list directory contents

No comments: