< Zurück | Inhalt | Weiter >

1.3.12 The man Command

Primitive but handy, the man command (short for manual ) was the early UNIX online manual. While we’ve come to expect (and ignore) online help, the idea of online manuals was rather revolutionary in the early days of UNIX. In contrast to walls of printed documentation, UNIX provided terse but definitive descriptions of its various commands. When they are done well, these descriptions are an invaluable handy reference. They are not the best way to learn about a command, but they can be a great guide to using the command’s options correctly.

The format is simply man followed by the name of the command about which you want information. So man man will tell you about the man command itself.

The most useful option to man is the -k option. It will do a keyword search in the titles of all the manpages looking for the keyword that you give. Try typing man -k java to see what commands are available. The (1) means that it’s a user command—something that you can type from the shell prompt, as opposed to (2) which is a system call or (3) which is a C library call. These numbers refer to the original UNIX documentation volumes (volume one was shell commands and so on), and it all fit into a single three ring binder.



TIP

One other way to find out something about a command, if you know the com- mand name already, is to ask the command itself for help. Most commands have either a -? or --help option. Try --help first. If you need to type -? either put it in single quotes or type it with a backslash before the question mark, as in -\?, since the ? is a pattern-matching character to the shell.

image


There are other help systems available, such as info and some GUI-based ones. But man provides some of the quickest and most terse help when you need to check the syntax of a command or find out if there is an option that does what you need.


1.4 REVIEW


We’ve looked at commands that will show you where files are in your directory structure, show files’ permissions and sizes, change the permissions, show you what is in a file, look for files by searching for strings, and look for files based on names or other properties.

Even so, we’ve given only the briefest coverage to only a few of the scores of Linux commands worth knowing. Tops among these is the shell, bash in our case. Whole books have been written on this subject, and you would do well to have one at hand.


1.5 WHAT YOU STILL DONT KNOW


The shell is a powerful language in its own right. While you think of it mostly as a command interpreter used for running other commands, it is, in fact, a language, complete with variables, logic and looping constructs. We are not suggesting that you write your application in shell scripts, but you will find it useful for automating many repetitive tasks. There is so much that can be done with shell scripts that we encourage you to read more about this and to talk with other Linux users.

Linux is replete with so many different commands. Some are powerful languages like awk and perl, others are simple handy utilities like head, tail, sort, tr, and diff. There are hundreds of other commands that we don’t even have time to mention.


1.6 RESOURCES


• Cameron Newham and Bill Rosenblatt, Learning the Bash Shell, O’Reilly Associates, ISBN 1565923472.

• Ellie Quigley, Linux Shells by Example, 4th ed., Prentice Hall PTR, ISBN 013147572X.

1.6 Resources 31

image


• Rafeeq Rehman and Christopher Paul, The Linux Development Platform, Prentice Hall PTR.

• Mark G. Sobell, A Practical Guide to Linux, Addison-Wesley, ISBN 0201895498.

• Mark G. Sobell, A Practical Guide to Red Hat Linux, Addison-Wesley, ISBN 0201703130.