Unformatted text preview:

Man PagesTypical Man Page SectionsMan Page LayoutExample 1: man whatisExercise A1Example 1Example 2Example 3Example 4Example 5File Descriptor I/O, Example 6Example 6 (Cont)File Pointer I/O, Example 7Uninitialized Ptr, Example 8Garbage, Example 9whosttylsOther CommandsUNIX ShellsStartup CommandsCommon Environment VariablesEnvironment Variable UsageSetenv/exportenv CommandMan Pagesman whatiswhatis(1)Typical Man Page SectionsUser commandsSystem callsC library functionsDevices and network interfacesFile formatsGames and demosEnvironments, tables, and troffmacrosSystem maintenance12345678ContentsSectionMan Page LayoutHEADER: a title for the individual man pageNAME: a one-line summarySYNOPSIS: describes usageAVAILABILITY: indicates availability on the systemDESCRIPTION: discusses what the command or function doesRETURN VALUES: the return values if applicableERRORS: summarizes errno values and conditions for errorsFILES: lists the system files that the command or function usesSEE ALSO: lists related cmds/additional sects of the manualENVIRONMENT: lists relevant environment variablesNOTES: provides info on unusual usage/implementation featuresBUGS: lists known bugs and caveatsExample 1: man whatiswhatis(1) user commands whatis(1)NAME: whatis – display a one-line summary about a keywordSYNOPSIS: whatis command …DESCRIPTION: whatis looks up a given command and displays the header line from the manual section. You can then run the man(1) command to get more information…FILES: /usr/share/man/windex table of contents andkeyword databaseSEE ALSO:apropos(1), man(1), catman(1M)Exercise A1--More– (41%)Indicates percentage of man page yet to be displayed.To get next screenful, hit space barTo get next line, hit returnTo quit hit qExample 1man intro displays man page for firstavailable section of a command (in this case the section 1 intro man page intro(1))Example 2man –k intro displays information about all sections of the man pages:Intro Intro (1) - introduction to commands andapplication programsIntro Intro (1m) - introduction to maintenancecommands and application programsIntro Intro (2) - introduction to system calls anderror numbersIntro Intro (3) - introduction to functions andlibrariesExample 3man –s 2 introdisplays only section 2 manpage of introExample 4man –a introDisplays man pages for all introsectionsExample 5The synopsis entry for system calls indicates the function prototype and library functions to include when using that command. For example, for write(2):SYNOPSIS#include <unistd.h>ssize_t write(int fildes, const void *buf, size_t nbyte);File Descriptor I/O, Example 6#include <unistd.h>#include<string.h>#define MYMESG “hello world\n”int bytes;bytes=write(STDOUT_FILENO, MYMESG, strlen(MYMESG));Note that if unistd.h were left out of the above example, STDOUT_FILENO would be undefined.Example 6 (Cont)Standard file descriptors:STDIN_FILENO standard input 0STDOUT_FILENO standard output 1STDERR_FILENO standard error 2File Pointer I/O, Example 7#include <stdio.h>fprintf(stdout, “hello world”\n);Uninitialized Ptr, Example 8#include <unistd.h>char *mybuf;size_t nbytes;write(STDOUT_FILENO, mybuf, nbytes);Code will likely produce uninitializedpointer error.Garbage, Example 9#include <unistd.h>char mybuf[100];size_t nbytes;write(STDOUT_FILENO, mybuf, nbytes);Code would probably print out garbage. Note that write function returns value of type ssize_t. Always capture it and test for errors (i.e., returns –1 with errno set to error type).whowho –HPrints out those who are logged on and on which terminal line.sttyPrint out command definitions with:stty -alsls (1)SYNOPSISls [-abcCdfFgilLmnopqrRstux1] [names]Each letter is described either in the DESCRIPTION or OPTIONS section of the man page.Other Commandsapropos cmdlists all man page entries where phrase “cmd” appearswhatis cmdgives a one line synopsis of the cmdwhich cmdgives a complete pathname of the file named “cmd”be careful that it is in the section you wantUNIX Shells• C shell (csh),• Bourne Shell (sh)• KornShell (ksh)Startup Commands• C shell takes startup commands from .cshrc• Bourn shell and KornShell take startup commands from .profileCommon Environment Variables• HOME=home directory• SHELL=shell of user• PATH=pathnames of directories to be searched when locating commands to be executed• LOGNAME=login name• USER=user name• MANPATH=pathnames of directories to be searched when locating man pages• DISPLAY=display to use for the X Window SystemEnvironment Variable UsageEnvironment variables are normally uppercase. Frequently used environment variables are initialized by the user in the startup file.Setenv/exportTry setenv (C shell) and export (KornShell) to determine the type of your shell.setenv EDITOR viexport EDITOR=vienv CommandSYNOPSISenv [-i] [name=value] … [utility [argument…]]POSIX.1, Spec 1170Modifies current environment with each name set to specified value and then executes utility with modified environment.env alone sends environment list to standard


View Full Document

Chico CSCI 372 - Man Pages

Download Man Pages
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Man Pages and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Man Pages 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?