Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS 497C – Introduction to UNIX Lecture 5: Understanding the UNIX Command Chin-Chih Chang

Similar presentations

Presentation on theme: "CS 497C – Introduction to UNIX Lecture 5: Understanding the UNIX Command Chin-Chih Chang"— Presentation transcript:

1 CS 497C – Introduction to UNIX Lecture 5: Understanding the UNIX Command Chin-Chih Chang

2 man: On-Line Help To understand details of commands, you can take on the UNIX documentation. man remains the most complete and authoritative guide to the UNIX system. To view the manual page of the C shell, you use man with csh as argument. man csh

3 man: On-Line Help The entire man page pertaining to the csh command is dumped on the screen. Man presents the first page and pauses. This is done by sending its output to a pager program, which displays the contents of a file one page (screen) at a time. You press a key ([Spacebar] or [Enter]) to see the next page. To quit the pager, press a q.

4 man: On-Line Help The pager is actually a UNIX command, and man is always preconfigured to be used with a specific pager. UNIX systems use these pager programs: –more, Berkleys pager now available universally and a superior alternative to the obsolete pg command. –less, the standard pager used by all Linux systems. When man displays a page, it doesnt tell you the pager it uses.

5 man: On-Line Help A pager has keys defined for viewing the previous and next page and terminating the program. See Table 2.1. Some important mans pager commands are : –Next page – [Spacebar] or f –Previous page – b or p –Quit – q –Search for keyword - /keyword –Repeat search - n

6 man: On-Line Help You can see the man pages of multiple commands with a single invocation of man. man cp mv rm To know more about man, use the following: man

7 The man documentation Vendors organize the man documentation differently, but in general youll see eight sections of the UNIX manual. Later enhancements have added subsections (like 1C, 1M, 3N etc.) The basic manual sections for SVR4 and Linux are shown in Table 2.2. Most of the commands you use are availale in Section 1, and man searches the manuals starting from Section 1.

8 The man documentation We can use a number option to specify the section. man 4 passwd You can specify multiple section numbers and multiple commands to look up. man 2 mount 4 passwd The structure of the man page is divided into a number of compulsory and optional sections where each section is preceded by a header.

9 Understanding a man Page The command headers are: –NAME – command name and its function –SYNOPSIS – arguments and options –DESCRIPTION – detailed explanation –EXAMPLES – examples of command usage –FILES – related files –SEE ALSO – related commands –DIAGNOSTICS – error messages –BUGS – errors that havent been fixed yet –AUTHOR(S) – author(s) of the command

10 Info: The Texinfo Document Many systems also support the Textinfo documentation (well call it the info documentation). The info is invoked with the command name: info tar Youll now see an emacs-type interface describing the table of contents.

11 Info: The Texinfo Document Info document is organized in nodes where one node represents a section of text at a certain level. Multilevel documents resemble the hypertext documents that are found in the World Wide Web. Within a page, you can use the [Page Up] and [Page Down] keys in the normal way for paging.

12 Info: The Texinfo Document You can take the cursor to any of these lines and press [Enter]. To return to the previous level, press u (up). You can also move using p (previous) and n (next). To quit info, use q. If you get stuck, just quit info with q. When in doubt, press h to see the complete list of key sequences accepted by the info reader.

13 whatis and apropos To get the short description of the command, use the whatis. whatis cp cp (1) - copy files If you have no idea about the command to use in a given situation, you should use the apropos command with one or more keywords.

14 whatis and apropos apropos gives you the name and short description from all manual sections that contain the keyword. $ apropos HTTP Both whatis and apropos can be used with multiple arguments. If your keyword contains more than one word, use quotes. $ apropos regular expression

15 whatis and apropos If you dont have the apropos command on your system, you can use man –k. You can use man –f in place of whatis. Most Linux offer the --help option that displays a compact listing of all options. $ ls --help

16 Coming Next Labor Day Holiday Do Self-Test of Chapter 2 Turn in Homework 1 (September 5) General-Purpose Utilities

Download ppt "CS 497C – Introduction to UNIX Lecture 5: Understanding the UNIX Command Chin-Chih Chang"

Similar presentations

Ads by Google