WCC logo

CIS120Linux Fundementals

Apropos, Info and Whatis commands

In Linux, the apropos, info, and whatis commands are essential tools for finding and understanding command-line utilities and their functions. These commands help users navigate the vast amount of documentation available in Linux systems, making it easier to find relevant information about commands and programs.

The apropos Command

The apropos command searches the manual page names and descriptions for a keyword or phrase, returning a list of commands and their brief descriptions that match the search criteria. This is particularly useful when you know what a command should do but do not remember the exact command name. The apropos command is often used to find commands related to a specific topic.

Example Usage:

apropos copy

Output:

bcopy (3)             - copy byte sequence
    cp (1)                - copy files and directories
    copy_file_range (2)   - copy a range of data from one file to another
    dd (1)                - convert and copy a file
    memccpy (3)           - copy memory area
    memcpy (3)            - copy memory area
    memmove (3)           - copy memory area
    scopy (3)             - copy vectors
    strcpy (3)            - copy a string
    strlcpy (3)           - copy a string with size limit
    strncpy (3)           - copy a fixed number of characters from a string

Common Options for the apropos Command

Option Description
-a Combine multiple search keywords with a logical AND.
-e Use exact matching for search keywords.
-l Display output in a long listing format.
-s Search only within the specified manual section(s).
-w Search for whole words only.

The info Command

The info command provides access to the GNU info system, which contains detailed documentation for many commands and programs. Unlike the man pages, which provide a single, often concise entry, info pages can contain more comprehensive and structured documentation. The info system uses a tree structure and hyperlinks to navigate from one section to another, making it easier to explore detailed documentation.

The tree structure of info documentation allows users to start from a top-level menu and navigate through various nodes (sections), similar to browsing a website. Each node can contain links to other nodes, enabling users to jump directly to related topics or subtopics.

Example Usage:

info bash

This command will open the info documentation for the Bash shell, providing detailed information on its features and usage. The top-level menu will look something like this:

File: bash.info,  Node: Top,  Next: Introduction,  Up: (dir)

Bash (GNU Bourne-Again SHell)
*****************************

This manual is for Bash, the GNU command-line interpreter. This edition
describes Bash version 5.1.

* Menu:

* Introduction::                An introduction to the shell.
* Basic Shell Features::        The shell's basic features.
* Shell Builtin Commands::      Commands that are built into the shell.
* Shell Variables::             Variables used by the shell.
* Shell Arithmetic::            Shell arithmetic.
* Job Control::                 Job control features.
* Shell Commands::              Commands defined internally by the shell.
* Shell Functions::             Shell functions.
* Shell Scripts::               Shell scripts.
* Shell Grammar::               Shell grammar rules.
* Command Line Editing::        Command line editing features.
* Installing Bash::             How to build and install Bash.
* Reporting Bugs::              How to report bugs in Bash.
* GNU Free Documentation License::  Your rights under this license.
* Index::                       Index of concepts and functions.

To navigate through the documentation, you can use the arrow keys to move between nodes or press Enter to follow a hyperlink. For example, selecting "Basic Shell Features" and pressing Enter will take you to a detailed section on basic shell features.

Common Options for the info Command

Option Description
--all Display all available info documentation.
--apropos Search all indexes for the specified string.
--directory Add the specified directory to the list of info directories.
--output Specify a file to which to write the output.
--help Display a help message with available options.
Key Function
h Open the help menu
? Show help summary
q Quit the info viewer
Space Scroll forward one page
Backspace Scroll backward one page
n Move to the next node
p Move to the previous node
u Move up one level in the hierarchy
l Move back to the last visited node
t Move to the top (root) of the documentation
m Open a menu (then type the menu item name)
Enter Follow a hyperlink (when the cursor is on it)
Tab Jump to the next hyperlink
Shift + Tab Jump to the previous hyperlink
[ Move to the last node visited
] Move to the next node in the sequence

The whatis Command

The whatis command displays a one-line description of a specified command. It is used to quickly get an overview of what a command does, without delving into the full documentation provided by the man or info commands. The whatis command searches the manual page database for the given command name and displays the summary line from the relevant manual page.

Example Usage:

whatis ls

Output:

ls (1)               - list directory contents

Common Options for the whatis Command

Option Description
-l Display output in a long listing format.
-w Search for whole words only.
-r Use a regular expression for the search pattern.
-s Search only within the specified manual section(s).
--help Display a help message with available options.