Home > Linux > Getting help from the Linux shell(man, apropos, whatis)

Getting help from the Linux shell(man, apropos, whatis)

You are sitting in front of a Linux terminal, no access to internet, no friends around and you need some help for commands you are about to execute. So what now, from where you can get help?

From that same terminal of course 🙂

In terminal, there are a lot of tools designed to help user, explain how commands work, how to find exactly the command that you need, and what are available options for that command.

For this purpose we can use these commands – man, apropos, whatis.

Man command
===========

Man pages, short for manual pages are built-in system documentation. This documentation is divided into sections. Execute man man command to read more about man pages. Sections are:

1   Executable programs or shell commands
2   System calls
3   Library calls
4   Special files
5   File formats and conventions

6   Games
7   Miscellaneous
8   System administration commands
9   Kernel routines
Basic usage of this command ( for ls command as example ) is

man ls

Apropos
=======
Apropos search the manual pages and descriptions, and it searches strings, not complete words and commands. Very handy if you need the command, you know a part of it or its description, but you can’t remember exact command name.

Whatis
======
Whatis searches lists of commands, but for a complete word match.

See this example to better understand difference between apropos and whatis.

apropos delete

and

whatis delete

First command lists all commands displays all commands and descriptions with delete word, and second returns nothing apropriate. 🙂

First question now could be – can I get a list of all available commands in my Linux box?
We can use

apropos .

or

man -K .

Dot (.) here means ‘any character’.
Since there are many command you could redirect these commands to a file, using >

apropos . > commands.txt

for example.

Second question here could be – how can i get a list of all available commands from section 8 ( system administration commands ) ?
Use man or apropos, but limit command to show you only those commands like this

apropos -s 8 .

Third question here could be – how can I find all the commands that have something to do with delete word? For example delete user, delete file, folder, group etc.
Use

apropos . -w ‘*delete*’

or

apropos delete

And result is something like this

argz_delete (3)      – functions to handle an argz list
at (1)               – queue, examine or delete jobs for later execution
batch (1)            – queue, examine or delete jobs for later execution
groupdel (8)         – delete a group
lppasswd (1)         – add, change, or delete digest passwords.
mdel (1)             – delete an MSDOS file
mdeltree (1)         – recursively delete an MSDOS directory and its rmdir (2)            – delete a directory
……….

Or you could use

man -K delete

for similar results, but this query is a little slower.

After this, search man page for command that you need to see all available options and usage.
And what is the number meaning in this output? Numbers represents sections earlier mentioned.

Ok, so now that you have your command, how to see exactly how this command work?
Man pages of course, but you can use info command al well.

Sometimes info command can provide more detailed explanation than man command.

Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: