Linux info Command with Practical Examples

LinuxLinuxBeginner
Practice Now

Introduction

In this lab, you will learn how to use the Linux info command, which provides detailed information about various Linux commands, utilities, and system functions. You will explore the purpose and usage of the info command, understand its options and navigational techniques, and apply it to retrieve information about different Linux tools. The lab covers the essential features of the info command, including its hierarchical, hypertext-like format, which allows you to navigate through related topics and cross-references more efficiently than the traditional man pages.

Linux Commands Cheat Sheet


Skills Graph

%%%%{init: {'theme':'neutral'}}%%%% flowchart RL linux(("`Linux`")) -.-> linux/BasicSystemCommandsGroup(["`Basic System Commands`"]) linux(("`Linux`")) -.-> linux/BasicFileOperationsGroup(["`Basic File Operations`"]) linux/BasicSystemCommandsGroup -.-> linux/help("`Command Assistance`") linux/BasicSystemCommandsGroup -.-> linux/man("`Manual Access`") linux/BasicFileOperationsGroup -.-> linux/ls("`Content Listing`") subgraph Lab Skills linux/help -.-> lab-422736{{"`Linux info Command with Practical Examples`"}} linux/man -.-> lab-422736{{"`Linux info Command with Practical Examples`"}} linux/ls -.-> lab-422736{{"`Linux info Command with Practical Examples`"}} end

Understand the Purpose and Usage of the info Command

In this step, we will explore the purpose and usage of the info command in Linux. The info command is a tool that provides detailed information about Linux commands, utilities, and system functions.

The info command is similar to the man command, but it provides a more structured and interactive way to access documentation. Unlike the man pages, which are typically displayed in a single, scrollable window, the info command presents information in a hierarchical, hypertext-like format, allowing you to navigate through related topics and cross-references.

Let's start by running the info command without any arguments:

$ info

This will open the top-level info menu, which provides an overview of the available topics and how to navigate the info system.

Example output:

This is the top of the INFO tree

This (the Directory node) gives a menu of major topics.
Typing "q" exits, "?" lists all INFO commands, "d" returns here,
"h" gives a primer for first-timers,
"mEmacs<Return>" visits the Emacs manual, etc.

In Emacs, you can click mouse button 2 on a menu item or cross-reference
to select it.

* Menu:

* Getting Started: (info-starters).   Getting started with Info.
* Info Basics:       (info-basics).   Info's essential features.
* Info Commands:     (info-commands). All Info commands.
* Info Files:        (info-files).    The Info directory.
* Info Internals:    (info-internals).Internal details of Info.

As you can see, the info command provides a menu-driven interface that allows you to navigate through various topics and access detailed information about different Linux commands and utilities.

To explore a specific topic, you can type the topic name (e.g., info-commands) and press Enter. This will take you to the corresponding section, where you can read the documentation and navigate to related topics.

The info command also supports various navigation commands, such as:

  • n: Move to the next node
  • p: Move to the previous node
  • u: Move up to the parent node
  • d: Move to the directory node (top-level menu)
  • q: Quit the info command

Now that you have a basic understanding of the info command, let's move on to the next step, where we'll explore the various options and navigation techniques in more detail.

In the previous step, we learned about the basic purpose and usage of the info command. Now, let's explore the various options and navigational techniques available within the info command.

First, let's take a look at some of the common options for the info command:

$ info --help
Usage: info [OPTION]... [MENU-ITEM...]
Start the Info tutorial and read documentation for MENU-ITEM.

Options:
  -k, --apropos=STRING       look up STRING in all indices of all manuals
  -d, --directory=DIR        add DIR to INFOPATH
  -f, --file=FILENAME        specify Info file to visit
  -n, --node=NODENAME        specify nodes in first visited Info file
  -o, --output=FILENAME      output selected nodes to FILENAME
  -R, --raw-escapes          pass through escape sequences (for debugging)
  -P, --pager=PROGRAM        use PROGRAM as the pager
  --vi-keys                  use vi-like key bindings
  -h, --help                 display this help and exit
  -V, --version              display version information and exit

As you can see, the info command supports various options that allow you to customize its behavior, such as specifying the Info file to visit, the node to start from, or the pager program to use.

Now, let's explore some of the key navigational commands within the info command:

$ info

Once you're in the info command, you can use the following commands to navigate:

  • n: Move to the next node
  • p: Move to the previous node
  • u: Move up to the parent node
  • d: Move to the directory node (top-level menu)
  • l: Go back to the last node you visited
  • m: Go to a menu item by name
  • g: Go to a node by name
  • s: Search for a string within the current node
  • ?: Display a list of all available commands

Try out these navigation commands and explore the various topics and nodes within the info system. Remember, you can always return to the top-level directory by typing d.

Apply the info Command to Retrieve Information About Linux Commands and Utilities

Now that you're familiar with the info command and its navigation techniques, let's put your knowledge into practice by using the info command to retrieve information about various Linux commands and utilities.

First, let's try to find information about the ls command:

$ info ls

This will open the info page for the ls command, where you can read about its usage, options, and related information.

Example output:

File: dir,  Node: ls,  Up: Directory listing

ls: List directory contents
*****************************

The 'ls' command lists information about files (of any type, including
directories).

Synopsis:
  ls [OPTION]... [FILE]...

Options:
  -a, --all                  do not hide entries starting with .
  -A, --almost-all           do not list implied . and ..
  -b, --escape               print octal escapes for nongraphic characters
  -B, --ignore-backups       do not list implied entries ending with ~
  -c                         with -lt: sort by, and show, ctime (time of last
                             modification of file status information)
                             with -l: show ctime and sort by name
                             otherwise: sort by ctime
...

As you can see, the info command provides detailed information about the ls command, including its synopsis, options, and related details.

You can also use the info command to find information about other Linux commands and utilities. For example:

$ info cd
$ info mkdir
$ info grep

Each of these commands will open the corresponding info page, allowing you to explore the details of the command.

Remember, you can use the navigation commands you learned in the previous step to move around the info system, such as n to go to the next node, p to go to the previous node, and u to go up to the parent node.

Summary

In this lab, we first explored the purpose and usage of the info command in Linux, which provides detailed information about Linux commands, utilities, and system functions in a hierarchical, hypertext-like format. We learned that the info command is similar to the man command but offers a more structured and interactive way to access documentation. We then examined the various options and navigational techniques available in the info command, allowing us to efficiently explore and retrieve information about different Linux commands and utilities.

Linux Commands Cheat Sheet

Other Linux Tutorials you may like