Anatomy of a man page
This content delves into the structure and utility of man pages in the Unix system. It covers a comprehensive guide on how to navigate through the online manual pages using commands like man and fgets. The provided images assist in understanding the layout and information presented in these man pages, enhancing your knowledge and proficiency in utilizing the Unix system effectively.
Download Presentation

Please find below an Image/Link to download the presentation.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.
You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.
E N D
Presentation Transcript
man man man(1) NAME man - format and display the on-line manual pages
man man Use the man command to find out about the man command. man(1) NAME man - format and display the on-line manual pages
man man man(1) the man command is in section 1 of the unix manual NAME man - format and display the on-line manual pages
man man man(1) NAME man - format and display the on-line manual pages Name of the command
man man man(1) NAME man - format and display the on-line manual pages brief description
man fgets GETS(3) Linux Programmer's Manual GETS(3) NAME fgetc, fgets, getc, getchar, gets, ungetc - input of characters and strings What section of the manual is this in? What other commands are covered on this page?
man fgets SYNOPSIS #include <stdio.h> This section describes the needed include files, function prototypes, parametes and options int fgetc(FILE *stream); char *fgets(char *s, int size, FILE *stream); int getc(FILE *stream); int getchar(void); char *gets(char *s); int ungetc(int c, FILE *stream);
man fgets SYNOPSIS #include <stdio.h> int fgetc(FILE *stream); char *fgets(char *s, int size, FILE *stream); int getc(FILE *stream); int getchar(void); char *gets(char *s); int ungetc(int c, FILE *stream);
man fgets SYNOPSIS #include <stdio.h> int fgetc(FILE *stream); char *fgets(char *s, int size, FILE *stream); int getc(FILE *stream); int getchar(void); char *gets(char *s); int ungetc(int c, FILE *stream);
man fgets What does a call to fgets look like? SYNOPSIS #include <stdio.h> int fgetc(FILE *stream); char *fgets(char *s, int size, FILE *stream); int getc(FILE *stream); int getchar(void); char *gets(char *s); int ungetc(int c, FILE *stream);
SYNOPSIS Some conventions: emboldened Type exactly as shown. italic or underlined Replace with appropriate argument. [-abcxyz] All flags within square brackets are optional. -a | -b Options separated by pipe cannot be used together. Mandatory argument, usually found in option descriptions. <mandatory> {yes, no} Limited options, only those specified will work. Arguments followed by an ellipses can be repeated.
DESCRIPTION DESCRIPTION describes each of the commands on the page fgetc() reads the next character from stream and returns it as an unsigned char cast to an int, or EOF on end of file or error. getc() is equivalent to fgetc() except that it may be imple [m mented as a macro which evaluates stream more than once. getchar() is equivalent to getc(stdin). gets() reads a line from stdin into the buffer pointed to by s until either a terminating newline or EOF, which it replaces with a null byte ('\0'). No check for buffer overrun is per [m formed (see BUGS below).
OPTIONS An more detailed description of any options listed in the synopsis section
DESCRIPTION (contd) fgets() reads in at most one less than size characters from stream and stores them into the buffer pointed to by s. Read [m ing stops after an EOF or a newline. If a newline is read, it is stored into the buffer. A terminating null byte ('\0') is stored after the last character in the buffer. ungetc() pushes c back to stream, cast to unsigned char, where it is available for subsequent read operations. Pushed-back characters will be returned in reverse order; only one pushback is guaranteed. Calls to the functions described here can be mixed with each other and with calls to other input functions from the stdio library for the same input stream. For nonlocking counterparts, see unlocked_stdio(3).
RETURN VALUE RETURN VALUE fgetc(), getc() and getchar() return the character read as an unsigned char cast to an int or EOF on end of file or error. gets() and fgets() return s on success, and NULL on error or when end of file occurs while no characters have been read. ungetc() returns c on success, or EOF on error.
EXAMPLES Some manuals will provide examples of use very helpful if you have trouble deciphering the synopsis!
CONFORMING TO C89, C99, POSIX.1-2001. LSB deprecates gets(). POSIX.1-2008 marks gets() obsolescent. ISO C11 removes the specification of gets() from the C language, and since version 2.16, glibc header files don't exposethe function declaration if the _ISOC11_SOURCE feature test macro is defined.
BUGS BUGS Never use gets(). Because it is impossible to tell without knowing the data in advance how many characters gets() will read, and because gets() will continue to store characters past the end of the buffer, it is extremely dangerous to use. It has been used to break computer security. Use fgets() instead. It is not advisable to mix calls to input functions from the stdio library with low-level calls to read(2) for the file descriptor associated with the input stream; the results will be undefined and very probably not what you want.
SEE ALSO SEE ALSO read(2), write(2), ferror(3), fgetwc(3), fgetws(3), fopen(3), fread(3), fseek(3), getline(3), getwchar(3), puts(3), scanf(3), ungetwc(3), unlocked_stdio(3), feature_test_macros(7)
COLOPHON a brief statement containing information about the publication of a book such as the place of publication, the publisher, and the date of publication. COLOPHON This page is part of release 3.54 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. GNU 2012-01-18 GETS(3)
apropos Same behavior: man k keyword apropos keyword
Manual 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 Miscellaneous (including macro packages and conventions), e.g. man(7 ), groff(7) 7 8 System administration commands (usually only for root) 9 Kernel routines (not normally found on Linux)
More examples man toupper, tolower man fopen man make man gcc man zip man -k ftp, man ftp man k ssh, man ssh