Book Image

Linux Utilities Cookbook

By : James Kent Lewis
Book Image

Linux Utilities Cookbook

By: James Kent Lewis

Overview of this book

<p>Linux is a stable, reliable and extremely powerful operating system. It has been around for many years, however, most people still don't know what it can do and the ways it is superior to other operating systems. Many people want to get started with Linux for greater control and security, but getting started can be time consuming and complicated. <br /><br />A practical, hands-on guide that provides you with a number of clear step-by-step examples to help you solve many of the questions that crop up when using an operating system you may not be familiar with.</p> <p>Presenting solutions to the most common Linux problems in a clear and concise way, this helpful guide starts with spicing up the terminal sessions by command retrieval and line editing, and shell prompt variables. We will then get to know the different desktops (GUIs) available for Linux systems and which is the best fit for you. We will then explore the world of managing files and directories, connectivity, and what to do when it goes wrong. We will also learn a range of skills, from creating and managing user accounts to securing your system, managing and limiting processes, and letting information flow from one process to another using pipes. Later, we will master disk management, working with scripts and automating tasks quickly, and finally, understand the need for a custom kernel and tips on how to build one.</p> <p><br />Based on the author's extensive experience, there is a section on best practices that every Linux user should be familiar with.</p>
Table of Contents (19 chapters)
Linux Utilities Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Using man pages


The man utility is an interface to the local reference manuals. It is used to quickly find information on programs, utilities, functions, and other topics. The man utility will accept several options; however, the usual invocation is simply man page, where page actually refers to a topic. You can even run man by itself to learn how to use it.

The following is a screenshot of the command man man:

Running man on a page displays that topic of interest. The spacebar is used to page down, and Q is used to quit. Pages (topics) are presented in a more or less standard order with these possible section names: NAME, SYNOPSIS, CONFIGURATION, DESCRIPTION, EXAMPLES, OVERVIEW, DEFAULTS, OPTIONS, EXIT STATUS, RETURN VALUE, ENVIRONMENT, FILES, VERSIONS, CONFORMING TO, NOTES, BUGS, AUTHORS, HISTORY, and SEE ALSO.

man shows the first page found, even if there are more pages in other sections. For example, suppose you are looking for information on how to code the readlink function in your C program. You might try the following command:

man readlink

It brings up a page, but of the command readlink and not the C function. Why? Because it shows the first page, unless you specify the section number before the page. Well, how do you know what that is? You can run man with the -a option in the following manner:

man -a readlink

This brings up the command readlink as before. Now press Q to quit. The page goes away, but instead of terminating, the man session shows something as follows:

Big4 /lewis/Fedora/17 # man -a readlink
--Man-- next: readlink(2) [ view (return) | skip (Ctrl-D) | quit (Ctrl-C) ]

This is giving you a choice: pressing Enter will show the next page (topic), Ctrl + D will skip to the next topic, and Ctrl + C will end the man session. Pressing Q when you are on the last topic will cause man to terminate normally as before.

So what if you already know that you want the page from section 3 and load it directly? You can specify it in the following manner:

man 3 readlink

This will skip the first two and go right into the page for readlink out of the POSIX Programmer's Manual.

Here is a list of the section numbers and their names:

  • 1: Executable programs or shell commands

  • 2: System calls (functions provided by the kernel)

  • 3: Library calls (functions within program libraries)

  • 4: Special files (usually found in /dev)

  • 5: File formats and conventions (for example, /etc/passwd)

  • 6: Games

  • 7: Miscellaneous (including macro packages and conventions), for example, man(7) and groff(7)

  • 8: System administration commands

  • 9: Kernel routines

The local reference manuals can be a great source of information. They contain a wealth of data on just about everything in a Linux system. Unfortunately, they do have some drawbacks. Most are well-written and make sense. Some are, well, rather horrible. When this happens, there are other places to find help.