Module 06 : Getting Help

Exam Objective
2.2 Using the Command Line to Get Help
Objective Description
Running help commands and navigation of the various help systems

Introduction

Introduction

  • Knowing how to find help while working in Linux is an essential skill for any user.
  • Referring to help provides a quick reminder of how a command works.
  • This is a good information resource when learning new commands.

Man Pages

Man Pages

  • UNIX is the operating system that Linux was modeled after.
  • The developers of UNIX created help documents called man pages (short for manual page).
  • Man pages provide a basic description of the purpose of the command, as well as details regarding available options.

Viewing Man Pages

  • view a man page for a command, use the man command: man command
  • For example, the following displays the man page for the ls command:
  • Navigate the document using the arrow keys:
  • To exit viewing a man page, use the Q key.

Viewing Man Pages

Man Page Sections

  • Man pages are broken into sections.
  • Each section is designed to provide specific information about a command.
  • The following describes some of the more common sections found in man pages:
    • NAME: Provides the name of the command and a very brief description.
  • SYNOPSIS: Provides examples of how the command is executed.

Man Page Sections

  • DESCRIPTION: Provides a more detailed description of the command.
  • OPTIONS: Lists the options for the command as well as a description of how they are used
  • FILES: Provides a more detailed description of the command.
  • AUTHOR: Provides the name of the person who created the man page and (sometimes) how to contact the person.
  • REPORTING BUGS: Provides details on how to report problems with the command.
  • COPYRIGHT: Lists the options for the command as well as a description of how they are used
  • SEE ALSO: Provides you with an idea of where you can find additional information. This often includes other commands that are related to this command.

Searching Man Pages

  • To search a man page for a term, press the / and type the term followed by the Enter key.
  • If the term is not found, or upon reaching the end of the matches, the program will report Pattern not found (press Return).
  • If a match is found, to move to the next match of the term, press n. To return to a previous match of the term, press N.

Man Page Categorized by Sections

  • There are thousands of man pages on a typical Linux distribution.
  • To organize all of these man pages, they are categorized by sections.
  • By default there are nine default sections of man pages:
    • General Commands
    • System Calls
    • Library Calls
    • Special Files
    • File Formats and Conventions
    • Games
    • Miscellaneous
    • System Administration Commands
    • Kernel Routines

Man Page Categorized by Sections

  • The man command searches each of these sections in order until it finds the first match.
  • For example, the cal command belongs to the first section of man pages:
  • Sometimes there are man pages with the same name in different sections:
  • It may necessary to specify the section of the correct man page. To specify a different section, provide the number of the section as the first argument of the man command.

Finding Commands and Documentation

Finding Commands and Documentation

  • To search for the location of a command or the man pages for a command, use the whereis command.
  • This command searches for commands, source files and man pages in specific locations where these files are typically stored:
  • Man pages are easily distinguished from commands as they are typically compressed with a program called gzip, resulting in a filename that ends in .gz.

Find Any File or Directory

  • To find any file or directory, use the locate command.
  • This command searches a database of all files and directories that were on the system when the database was created.
    • However, any files created that day will not be searchable with the locate command because the database is updated nightly.
    • It is possible to update the locate database manually by running the updatedb command as root.
  • The output can be quite large so it may be helpful to use the following options:
    • The -c option to the locate command will list how many files match:
    • The -b option only includes listings that have the search term in the basename of the filename. To limit the output even further, place a \ character in front of the search term:

Info Documentation

Viewing Info Documentation

  • Man pages are excellent sources of information, but they do tend to have a few disadvantages:
    • Each man page is a separate document, not related to any other man page.
    • Man pages may can be difficult to read.
  • The info command also provides documentation on operating system commands and features.
    • Info documentation as a logical organizational structure, making reading documentation easier.
    • Information is broken down into categories that work much like a table of contents in a book.
  • Consider man pages to be more of a reference resource and info documents to be more of a learning guide.

Info Documentation

  • To display the info documentation for a command, use the info command:
  • You can navigate the document using the arrow keys.
  • This documentation is broken up into nodes. In the example below the line highlighted in white shows it’s currently in the ls invocation node:

Navigating Info Documentation

  • A listing of movement commands is available by hitting the Shift+H key while reading the info documentation.
  • To quit the info documentation, use the Q key.

Additional Help

Using the Help Option

  • Many commands will provide basic information, very similar to the SYNOPSIS found in man pages, by simply using the –help option to the command.

Additional System Documentation

  • On most systems, there is a directory where additional documentation is found, such as documentation files stored by third-party software vendors.
  • These documentation files are often called readme files since the files typically have names such as README or readme.txt.
  • Typical locations for these files include /usr/share/doc and /usr/doc.
Video 6.1 Commands and Navigation

Berikut file materi yang bisa di download :