Red Hat Linux 7 Unleashed

Red Hat Linux 7 Unleashed

By William Ball

Getting Help

All system administrators soon realize that they cannot possibly know everything about the operating system; it is too complex and it changes on a regular basis. A good system administrator, however, knows where to turn to get help. Because you are reading this book, you have at least started on your way to becoming a good system administrator. This book unleashes many of the tools and "secrets" of the Red Hat Linux operating system. With a book of this type, the index is very important. A book like this is not bought to be read from cover to cover, like a good C.S. Lewis novel, but is intended to be a resource guide—a place to go to find specific answers to specific questions. The following sections discuss the places you can turn to for help.

Using Man Pages

The man pages are like the Marines: They are your first lines of defense. Man pages contain the online version of the Red Hat Linux reference manuals and provide definitions and explanations of commands. I have referenced them a few times in this chapter. In addition, they provide optional parameters for commands to perform specific functions. Following all of the explanations are examples and other commands that are similar or relate to the command you looked up.

The format of the man pages is as follows:

Over time, especially in Linux, people have customized the man pages to include other optional fields. Some of these fields are Author, Sort Keys, Updating, and Notes. The additions have been made to enhance the pages. For example, the Author section many times includes an author's email address, which is handy if the command is not working as you expected it to. (Remember, none of Linux was taken from UNIX, so small differences do exist, even in the "standard" commands.)

Probably the one thing to point out to new man page users is the syntax used for showing the command's synopsis. Several standards are followed in writing commands that are used in the man pages. Here's the synopsis for the ps command:

SYNOPSIS
ps  [-]  [lujsvmaxScewhrnu]  [txx]  [O[+|-]k1[[+|-]k2...]] [pids]

Anything in square brackets ([]) is optional. Note that the only thing not optional in this command is the command itself. Therefore, you can issue the ps command without any options and you will receive a snapshot of the current processes.

[-] means that the - is an optional argument. Many commercial versions of UNIX require a dash to indicate that what follows are arguments. This is not true for the Red Hat Linux version of the ps command. The next set of characters (between the next set of square brackets) indicates that any of these parameters can be added to the ps command. For example, -la is a common set of parameters to add to the ls command; it displays a long list of all files, including hidden files.

The man pages are not a singular file or directory of Linux manuals. Instead, the man pages are a set of directories, each containing a section of the man pages. These directories contain the raw data for the man pages. Red Hat Linux has eight sections of man pages. In addition, each section has corresponding catn subdirectories that store processed versions of the man pages. When a man page is accessed, the program that formats the man pages saves a copy of the formatted man page in the catn (/var/catman/catn) directories. (This location can be changed in the /etc/man.config file to point to another location.) This saves time in the future; the next time a user requests a man page for a subject that has been accessed before, the formatting does not have to be repeated. Instead, it can be displayed from the previously formatted page. The following shows what information appears within each section:

Section Content
1 User commands
2 System calls
3 Functions and library routines
4 Special files, device drivers, and hardware
5 Configuration files and file formats
6 Games and demos
7 Miscellaneous: character sets, filesystem types, data type definitions, and so on
8 System administration commands and maintenance commands

The man command searches the sections in a predefined order: 1, 6, 8, 2, 3, 4, 5, and 7. It checks for commands first, followed by system calls and library functions, and then the other sections.

One of the really nice aspects of man pages is that they can be queried using a keyword search. Using the -k option allows you to search the pages for those that contain the specified word. To use this searching capability, you must first issue the command catman -w. This command (which takes a little while to process) indexes the man pages so that the keyword search will work. After running the catman command, the man pages can be searched, as in the following example:

[scooby@cartoons]$ man -k show
cnfsstat (8)         - show snapshot of CNFS
dnsdomainname (1)    - show the system's DNS domain name
domainname (1)       - show or set the system's NIS/YP domain name
fbset (8)            - show and modify frame buffer device settings
ftpcount (1)         - show current number of users for each class
ftpwho (1)           - show current process information for each ftp user.
hostname (1)         - show or set the system's host name
last, lastb (1)      - show listing of last logged in users
next (1)             - show the next message
nisdomainname (1)    - show or set system's NIS/YP domain name
nodename (1)         - show or set the system's DECnet node name
nwrights (1)         - Show effective rights for file or directory
prev (1)             - show the previous message
route (8)            - show / manipulate the IP routing table
ruptime (1)          - show host status of local machines
show (1)             - show (display) messages
show (l)             - show run-time parameters for session

It also lets you know if it finds no entries, as this example illustrates:

[scooby@cartoons]$ man -k Shaggy
Shaggy: nothing appropriate

Creating Man Pages

One of the benefits of man pages is that you can add your own local man pages. Adding man pages is a wonderful way of documenting tools that you write for use at your site. There are directories set up specifically for adding local man pages. They are /usr/local/man/man X, where X is the section number.

The simplest way to make a man page is to create a file containing text that describes the command or topic. However, it is fairly easy to make a more elaborate page that looks like a normal man page. Man pages are designed for the nroff text formatter and have text and nroff directives intermingled.

The best way to figure out what the different directives do is to view a man page and see how it is laid out. To do this with Linux, you must first unzip the file. Once unzipped, the file can be looked at with a text editor. All the different directives begin with a period (or dot). Table 21.8 lists many of the nroff directives and explanations of what they do.

Table 21.8. nroff directives

Directive Explanation
.B Uses bold type for the text (entire line is bolded).
.fi Starts autofilling the text (adjusting the text on the lines).
.I Uses italicized type for the text (entire line is italicized).
.IP Starts a new indented paragraph.
.nf Stops autofilling the text (adjusting the text on the lines).
.PP Starts a new paragraph.
.R Uses Roman type for text given as its arguments.
.SH Specifies the section heading (names are uppercase by convention).
.TH Specifies the title heading (arguments are command name and section).
.TP n Tags the paragraph (uses a hanging indent). The n specifies the amount to indent.

When testing the man page, you can simulate an actual man page call to the file with the following command:

[scooby@cartoons]$ nroff -man <file> | more

The man pages are not the only place where a resourceful system administrator can turn for answers. Also on your system are info pages, and assuming you installed them, HOWTO pages. You also have the Internet, where you can find email services, Web pages describing how to do things, and newsgroups.

Accessing Red Hat Mailing Lists and Newsgroups

Many mailing lists and newsgroups are available to assist you with your problems. After you have been using Linux for a while, you might even be able to answer some questions. Newsgroups are a great source of information. Before I list some newsgroups that are available to you, I want to first mention the Red Hat mailing lists (http://www.redhat.com/mailing-lists/list_subscribe.html).

These lists are maintained and monitored by Red Hat. Direct from Red Hat's Web page, here are a few of them:

Each of these lists has a subscription address, the list address with -request on the end of it. For example, for redhat-list, you send your subscription or unsubscription request to redhat-list-request@redhat.com. For the RPM list, you use rpm-list-request@redhat.com. All you need to send is the word subscribe in the subject line of your message to subscribe and unsubscribe in the subject line to unsubscribe. You can leave the body of the message empty.

Accessing Other Newsgroups and Web Pages

Other newsgroups require a newsreader. Most of the current browsers supply some kind of newsreader. There are somewhere around 15,000 to 20,000 newsgroups. Following is a list of some of interest to Linux users:

The preceding list consists of just a few of the actual newsgroups that specifically deal with Linux. Most of the others are similar to those listed. It is probably best to scan the newsgroups that you have access to for Linux.

In addition to newsgroups, myriad Web pages are devoted to Linux—Red Hat specifically. When I performed a search on WebCrawler (http://www.webcrawler.com) for Linux, the search located 17,789 documents; searching on Linux AND Redhat, the search located 2640 documents. Considering so many choices and the volatility of the Web, it might be helpful if I point out and briefly describe a few Web resources I believe will be around for a while.

The first one, which should be obvious, is Red Hat's home page at http://www.redhat.com. It is, of course, the first place to look for any information concerning Red Hat Linux. Also, for general Linux information, good places to start are http://www.linux.com and http://www.linux.org.

Another great source for information about Linux (as well as every other type of UNIX) is http://www.ugu.com, the UNIX Guru Universe page. According to the site's front page, it is "the largest single point UNIX resource on the Net!" This Web site is highly configurable and provides a great deal of information on everything of value to the UNIX community.

The Linux Documentation Project (http://www.linuxdoc.org) has a tremendous number of links, providing everything from general Linux information, to Linux user groups, to Linux development projects. Although I do not think there is much, if anything, unique about this site, it is complete. It has information on just about everything associated with Linux including a large library of HOWTOs to help you do everything from configuring an NFS server to hacking the Linux kernel.

Share ThisShare This

Informit Network