Interacting With The Linux Bash Manual
Most Linux distributions include an online manual for looking up information on shell commands, as well as lots of other GNU utilities included in the distribution. You should become familiar with the manual, because it’s invaluable for working with commands, especially when you’re trying to figure out various command line parameters.
The man command provides access to the manual pages stored on the Linux system. Entering the man command followed by a specific command name provides that utility’s manual entry. Figure Manual pages for the xterm command shows an example of looking up the xterm command’s manual pages. This page was reached by typing the command man xterm.
The man command provides access to the manual pages stored on the Linux system. Entering the man command followed by a specific command name provides that utility’s manual entry. Figure Manual pages for the xterm command shows an example of looking up the xterm command’s manual pages. This page was reached by typing the command man xterm.
Manual pages for the xterm command |
Notice the xterm command DESCRIPTION paragraphs in Figure 3.1. They are rather sparse and full of technical jargon. The bash manual is not a step-by-step guide, but instead a quick reference.
Tip
If you are new to the bash shell, you may find that the man pages are not very helpful at first. However, get into the habit of using them, especially to read the first paragraph or two of a command’s DESCRIPTION section. Eventually, you will learn the technical lingo, and the man pages will become more helpful to you.
When you use the man command to view a command’s manual pages, they are displayed with something called a pager. A pager is a utility that allows you to page through displayed text. Thus, you can page through the man pages by pressing the spacebar, or you can go line by line using the Enter key. In addition, you can use the arrow keys to scroll forward and backward through the man page text (assuming that your terminal emulation package supports the arrow key functions).
When you are finished with the man pages, press the q key to quit. When you quit the man pages, you receive a shell CLI prompt, indicating the shell is waiting for your next command.
Tip
The bash manual even has reference information on itself. Type man man to see manual pages concerning the man pages
The manual page divides information about a command into separate sections. Each section has a conventional naming standard as shown in The Linux man Page Conventional Section Names Table.
The Linux man Page Conventional Section Names Table |
Not every command’s man page has all the section names described in above Table. Also, some commands have section names that are not listed in the conventional standard.
Tip
What if you can’t remember the command name? You can search the man pages using keywords. The syntax is man -k keyword. For example, to find commands dealing with the terminals, you type man -k terminal.
In addition to the conventionally named sections for a man page, there are man page section areas. Each section area has an assigned number, starting at 1 and going to 9; they are listed in Table below.
The Linux man Page Section AreasTable |
Typically, the man utility provides the lowest numbered content area for the command.
Where the command man xterm was entered, notice that in the upper-left and upper-right display corners, the word XTERM is followed by a number in parentheses, (1). This means the man pages displayed are coming from content area 1 (executable programs or shell commands).
Occasionally, a command has man pages in multiple section content areas. For example, there is a command called hostname. The man pages contain information on the command as well as an overview section on system hostnames. To see the pages desired, you type man section# topic. For the command’s man pages in section 1, type man 1 hostname.
For the overview man pages in section 7, type man 7 hostname.
You can also step through an introduction to the various section content areas by typing man 1 intro to read about section 1, man 2 intro to read about section 2, man 3 intro to read about section 3, and so on.
The man pages are not the only reference. There are also the information pages called info pages. You can learn about the info pages by typing info info.
In addition, most commands accept the -help or —help option. For example, you can type hostname -help to see a help screen. For more information on using help, type help help. (See a pattern here?)
Obviously, several helpful resources are available for reference. However, many basic shell concepts still need detailed explanation. In the next section, we cover navigating through the Linux filesystem.
nice information, verry helping, thank you
ReplyDelete