next up previous
Next: Full-stops, Wildcards and Tab-Completion Up: Introduction to the Linux Previous: Files and Directories

Help!

As we've seen, many commands have lots of optional arguments. How do you know what options are available? In fact, how do you know what a new command does? What we need is a manual, which brings us neatly to the man command.

[pjh503@bhuna Linux]$ man ls
LS(1)                            User Commands                           LS(1)

NAME
       ls - list directory contents

SYNOPSIS
       ls [OPTION]... [FILE]...

DESCRIPTION
       List  information  about  the FILEs (the current directory by default).
       Sort entries alphabetically if none of -cftuSUX nor --sort.

       Mandatory arguments to long options are  mandatory  for  short  options
       too.

       -a, --all
              do not hide entries starting with .

       -A, --almost-all
              do not list implied . and ..

       --author
              print the author of each file

When viewing a man page the arrow keys move it up or down by a line, and the spacebar moves down by a page (`b' moves back up). To search for a particular string, press the forward slash `/', type the text you want, and press enter. Once you've started `n' will take you to the next occurence of your text.

You can use man -k to search all the man pages for certain keywords. This is useful to find a command for a particular task, but can give a lot of output.

A less common help command on Linux is info. The man pages will usually have everything you need, but info coreutils is useful for listing the basic commands and links to their individual info pages.

Many commands will also have a short built-in help invoked by a switch, but different commands use different conventions for what this switch should be. It is usually one of '-?', '-h' or '-help'.


next up previous
Next: Full-stops, Wildcards and Tab-Completion Up: Introduction to the Linux Previous: Files and Directories
Phil Hasnip 2007-08-23