Linux Guide/Getting Help

From Wikibooks, the open-content textbooks collection

Jump to: navigation, search

[edit] Built-In

Help for built-in commands are available from the help command. For example

help logout

Provides help on the logout command. Help just prints a few lines of text to the console. You may need to be in a shell for this to work.

Note that even common commands like cp and mv are not built-in. In addition, most built-in commands have man and info pages (see below) - so it is generally more useful to look in man or info first.

If you have no idea about what command you should use, but you have a vague idea about some keywords that may be related to the topic you want (e.g., you want to print something), you can use the apropos command, like this:

 apropos print

that will display a lot of things related to print.

[edit] Man Pages

See also Guide to UNIX

Man pages are a flexible format of help page: they can be viewed in the console, and can be viewed as HTML in a web browser. For example, to view the man page for cp, type

man cp

If you don't know the name of the command, you can search by using -k

man -k "copy"

Man is split into sections

  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 eg /etc/passwd
  6. Games
  7. Miscellaneous (including macro packages and conventions), e.g. man(7), groff(7)
  8. System administration commands (usually only for root)
  9. Kernel routines [Non standard]

If a page with the same name is in more than one section, the correct one can be accessed by specifying the section number:

man 1 cp

alternatively, specify -a to walk through all the sections

man -a cp

Man pages can also be viewed in web browsers. Some web browsers, such as Konqueror allow you to use man: like a protocol - for example, typing

man:cp

into the location bar shows the man page for cp. More generally, however, the man command can generate an HTML file, and then display it in a browser by using the -H command with the browser of your choice - in this example, firefox:

man cp -Hfirefox

[edit] Info Pages

See also Guide to UNIX

Info pages are another type of help page. Pages here are sometimes duplicates of man pages - and sometimes are more complete. To view an info page, type

info cp