UNIX For Dummies [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

UNIX For Dummies [Electronic resources] - نسخه متنی

John Levine, Margaret Levine Young

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید






Let’s Hear It from the man

You thought that UNIX was completely unhelpful. For the most part, you’re absolutely right. A standard UNIX command called

man (for manual), however, can give you online help.

Sound good? Well, yes and no. The information is there, all right, but it’s written in a rather nerdy style and can be difficult to decipher. Each part of the online manual is written, of course, on the assumption that you have read all the other parts and know what all the commands are called. The

man command is definitely worth knowing about, though, when you just can’t remember the options for a command or what to type where on the command line after the command name.

The

man ’s online manual contains manual pages for every UNIX command, and other pages about internal functions that programmers use, formats for various system file types, descriptions of some of the hardware that you can attach to your UNIX system, and other odds and ends. When you type the

man command, you indicate which page or pages you want.

All manual pages have a standard format. Chapter 5, you’re right.)

Listing 26-1: Part of the

man Page for the

chmod Command






CHMOD(1)                FreeBSD General Commands Manual               CHMOD(1)
NAME
chmod - change file modes
SYNOPSIS
chmod [-fhv] [-R [-H | -L | -P]] mode file ...
DESCRIPTION
The chmod utility modifies the file mode bits of the listed files as
specified by the mode operand.
The options are as follows:
-f Do not display a diagnostic message if chmod could not modify the
mode for file, nor modify the exit status to reflect such fail-
ures.
-H If the -R option is specified, symbolic links on the command line
are followed. (Symbolic links encountered in the tree traversal
are not followed by default.)
-h If the file is a symbolic link, change the mode of the link
itself rather than the file that the link points to.
-L If the -R option is specified, all symbolic links are followed.
-P If the -R option is specified, no symbolic links are followed.
This is the default.

The parts of the manual page include



    The title (the first line): It includes the name and page number of the manual page on the left and right ends of the line. Centered on the line may be the name of the system the command is a part of. In Listing 26-1, the

    chmod command is one of the standard commands that comes with FreeBSD, as it does with every version of UNIX.



    NAME : The one-line name of the manual page. The name is usually the command or commands the page talks about, as well as a brief description.



    SYNOPSIS : What you type when you give the command, with a terse and cryptic example of every option available. This part often makes no sense until you read the description that follows. Sometimes it still makes no sense.



    DESCRIPTION : A few paragraphs about the command. For commands with a large number of options, the description can run for a few pages. A list of options usually is included, with an explanation of every one. Sometimes you see examples, although not often enough.



    SEE ALSO : Lists names of related manual pages, if any.



    WARNINGS and

    BUGS : May list a command’s known bugs or common problems. Then again, it may not.



    files : A list of the files this command uses. The

    pine and

    mail commands, for example, use your

    Mail directory, the central list of mailboxes, and other files. (Your system administrator usually sets up these files — they’re rarely something you want to fool with yourself.) The manual pages for

    pine and

    mail mention these files.














    Reading manual pages


    To see a manual page, type this line:


    man unixcommand

    Except, of course, you substitute for unixcommand the name of the UNIX command you’re interested in. Most versions of

    man present the manual page a screen at a time. Other versions just whip the page by at maximum speed, assuming that you can read 150,000 words per minute. If that happens (and you can’t read that fast), you can use the usual

    more command to display the manual page a screen at a time by typing this command:


    man unixcommand | more


    Printing manual pages


    You can also print the manual pages for later perusal. To print the manual pages, type this line:


    man unixcommand | lpr

    Remember to use

    lp , if that is the command you use to print. A better technique may be to put the manual pages in a file first, remove the information you don’t want, and print the result. You can type the following line, for example (remember to substitute for filename the name of the file you want the information in):


    man unixcommand > filename

    Then edit the file with a text editor (see Chapter 10) and print it (see Chapter 9). Before you print the file, however, keep in mind that the online manual pages are generally identical to the printed manual pages in the dusty UNIX manuals on the shelf, except that the printed manual pages are typeset so that they’re easier to read. Rather than print the online page, looking it up in the paper manual is often better. (Bet you didn’t think we would ever tell you to do that!)

    Tip If you have a PostScript laser printer, you can often print the manual pages with nice fonts and italics and such rather than the typewriter-like version you see on-screen. Ask your local guru for advice. On many versions of UNIX, this command works, using the

    -t for typeset option:


    man -t command | lpr


    Finding the manual page you want


    If you use the

    man command, you have no good way to find out which manual pages are available. Sometimes, finding the one you want is difficult. Suppose that you type this line:


    man ln

    UNIX shows you this message:

    man: ln not found

    The

    ln command has no separate manual page. Instead, it shares a set of pages with

    cp and

    mv . You get information about

    ln by typing this line:


    man cp

    (Typical UNIX ease of use!) If

    man doesn’t display anything about the command you want, try some similar commands. BSD UNIX systems have an

    apropos command that suggests manual pages relevant to a particular topic, so you can type apropos ln to see what it has to say.

    In addition to manual pages about commands, you can find lots of pages about other topics. You can type this line, for example:


    man ascii

    This command shows you a table of the ASCII-character codes for all the characters text files can contain. Although you probably aren’t interested in them, it does look impressively technoid.


    It’s a bird, it’s a plane, it’s xman!


    If you use KDE, GNOME, or other X Window-based software, you can use the

    xman command to look at manual pages. The nice thing about

    xman is that it displays a list of the available manual pages. When you run

    xman , it pops up a little box with three buttons, one of which is labeled Manual Page. If you click that button, a larger window then displays a manual page describing

    xman . Choose Display Directory from the Options menu on that page, or press Ctrl+D as a shortcut, to see a screen of all the manual pages it has — probably more than 100 of them. Click the one you want to see, and

    xman switches to that page. Press Ctrl+D again to return to the directory of manual pages. Read the initial description of

    xman for other tricks you can get

    xman to do, such as show you two or three different pages at a time or search for keywords in manual-page titles.

/ 213