Getting Help from the Commands Themselves


There is one more common and useful method for obtaining help or documentation about a specific Linux command. Nearly every command supports either -h, -help, or --help as a special option that causes the command to print a brief help message and exit. Listing 18.1 shows one such help message.

Listing 18.1. Output of the rm --help Command
 Usage: rm [OPTION]... FILE... Remove (unlink) the FILE(s).   -d, --directory       unlink FILE, even if it is a non-empty directory                           (super-user only; this works only if your system                            supports `unlink' for nonempty directories)   -f, --force           ignore nonexistent files, never prompt   -i, --interactive     prompt before any removal       --no-preserve-root do not treat `/' specially (the default)       --preserve-root   fail to operate recursively on `/'   -r, -R, --recursive   remove the contents of directories recursively   -v, --verbose         explain what is being done       --help     display this help and exit       --version  output version information and exit To remove a file whose name starts with a `-', for example `-foo', use one of these commands:   rm -- -foo   rm ./-foo Note that if you use rm to remove a file, it is usually possible to recover the contents of that file.  If you want more assurance that the contents are truly unrecoverable, consider using shred. Report bugs to <bug-coreutils@gnu.org>. 

Help obtained this way is often very brief, filling less than one screen and providing only the most commonly used options and arguments for a given command. Although the man or info page is almost always more exhaustive, you might find that the -h, -help, or --help options are more readily accessible in day-to-day use.

How Do You Know Whether to Use -h, -help, or --help?

Generally, try the options in this order: --help, -h, and -help. If none of these options seems to provide a help listing for a specific command, consult the man or info page for the command instead.




    SAMS Teach Yourself Red Hat(r) Fedora(tm) 4 Linux(r) All in One
    Cisco ASA and PIX Firewall Handbook
    ISBN: N/A
    EAN: 2147483647
    Year: 2006
    Pages: 311
    Authors: David Hucaby

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net