Red Hat System Administration I
Look up documentation to help you to complete tasks.
Outcomes
Locate relevant information for commands by searching man pages.
Learn new options for the most common documentation commands.
Use appropriate tools to view and print documentation and other non-text formatted files.
As the student user on the workstation machine, use the lab command to prepare your system for this exercise.
This command prepares your environment and ensures that all required resources are available.
[student@workstation ~]$ lab start help-review
Instructions
On the
workstationmachine, determine how to prepare a man page for printing. Specifically, find which is the default format or rendering language for printing.Use the
man mancommand to determine how to prepare a man page for printing.[student@worksation ~]$
man man...output omitted...man -t bash | lpr -PpsFormat the manual page for bash into the default troff or groff format and pipe it to the printer named ps. The default output for groff is usually PostScript. man --help should advise as to which processor is bound to the -t option. ...output omitted...Press q to quit the man page.
Note
The
mancommand-toption prepares a man page for printing, using by default PostScript.
Create a PostScript-formatted output file of the
passwdman page. Call the filepasswd.psand place it in thestudentuser's home directory. Determine the file format. Inspect the contents of thepasswd.psfile by using thelesscommand.Note
Because you need to save the output of the
mancommand to a file, you can use the > symbol, which redirects the standard output to a file.As an example, the following command lists the home directory's regular file names into a file.
[student@workstation ~]$
ls > /tmp/my-file-namesThis command is taught in more detail in a following chapter.
Use the
man -tcommand to create a formatted file of thepasswdman page.[student@workstation ~]$
man -t passwd > passwd.ps[student@workstation ~]$ls -al...output omitted... -rw-r--r--. 1 student student 20168 Mar 8 09:02 passwd.ps ...output omitted...Use the
filecommand to determine the file format.[student@workstation ~]$
file /home/student/passwd.ps/home/student/passwd.ps:PostScriptdocument text conforming DSC level 3.0Use the
lesscommand to view the/home/student/passwd.psfile.[student@workstation ~]$
less /home/student/passwd.ps%!PS-Adobe-3.0 %%Creator: groff version 1.22.3 %%CreationDate: Tue Feb 26 11:14:40 2019 %%DocumentNeededResources: font Times-Roman %%+ font Times-Bold %%+ font Times-Italic %%+ font Symbol %%DocumentSuppliedResources: procset grops 1.22 3 ...output omitted...Note
The output of
filestates that the file is in PostScript format, and you can confirm it by viewing the file's contents. Notice the header lines of PostScript information. Use q to quit thelesscommand.
By using the man pages, find which commands you can use for viewing and printing PostScript files.
Search in the man pages for information about PostScript files. Use the
-koption for this purpose.[student@workstation ~]#
man -k postscript viewerenscript (1) - convert text files to PostScript, HTML, RTF, ANSI, and overstrikes eps2eps (1) - Ghostscript PostScript "distiller"evince (1) - GNOME document viewerevince-previewer (1) - show a printing preview of PostScript and PDF documents evince-thumbnailer (1) - create png thumbnails from PostScript and PDF documents gcm-viewer (1) - GNOME Color Manager Profile Viewer Tool ...output omitted...Note
Using multiple words with the
-koption finds man pages that match any word; such as "postscript" or "viewer" in their descriptions. Notice theevince(1) commands in the output.
Learn how to use the
evince(1) viewer in preview mode. Also, determine how to open a document to start on a specific page. Open your PostScript file by usingevincethree times: first by using the default mode, and then with the preview mode option, and finally to start at page 3. Close your document file when you finish.Use the
man evincecommand to learn how to use the viewer in preview mode.[student@workstation ~]$
man evince...output omitted... -i, --page-index=NUMBER Open the document on the page with the specified page index (this is the exact page number, not a page label). ...output omitted... -w, --preview Run evince as a previewer. ...output omitted...Press q to quit the man page.
Note
The
-w(or--preview) option opensevincein preview mode. The-ioption opensevinceat the specified starting page.Use the
evincecommand to open the/home/student/passwd.psfile.[student@workstation ~]$
evince /home/student/passwd.psUse the
evince -w /home/student/passwd.pscommand to open the file in preview mode.[student@workstation ~]$
evince -w /home/student/passwd.psUse the
evince -i 3 /home/student/passwd.pscommand to open the file at page 3.[student@workstation ~]$
evince -i 3 /home/student/passwd.psNote
Whereas the normal
evincemode supports full-screen and presentation-style viewing, theevincepreview mode is useful for quick browsing and printing. Notice the at the top.
By using the man pages, research
lp(1) to determine how to print any document to start on a specific page. Without entering any commands (in the absence of printers), learn the syntax, in one command, to print only pages 2 and 3 of your PostScript file.Use the
man lpcommand to determine how to print specific pages of a document.[student@workstation ~]$
man lp...output omitted... -P page-list Specifies which pages to print in the document. The list can contain a list of numbers and ranges (-) separated by commas, e.g., "1,3-5, 16". The page numbers refer to the output pages and not the document's original pages - options like "number-up" can affect the numbering of the pages. ...output omitted...Press q to quit the man page.
Note
From
lp(1), you learn that the-Poption specifies the page list to print in the document. Thelpcommand spools to the default printer, and sends only the page range to start on 2 and to end on 3. Therefore, one valid answer islp passwd.ps -P 2-3.
Use the Firefox browser to open the system's man page directory (
/usr/share/doc) and browse to theman-dbpackage subdirectory. View the provided manuals. After you finish reviewing theman-dbmanuals, locate and browse to thekexec-toolspackage subdirectory. View thekexec-kdump-howto.txtfile, which describes important system configurations that are stored in the/etc/sysconfigdirectory.Use
firefox /usr/share/docto view system documentation. Browse theman-dbsubdirectory. Click the manuals to view them.[student@workstation ~]$
firefox /usr/share/docThe
firefoxcommand might return output that is unrelated to the Satellite console.Note
You can create bookmarks for any frequently used directory. After browsing the
man-dbdirectory, click to open and view the text version of the manual, and then close it. Click to open the PostScript version. As observed earlier,evinceis the system's default viewer for PostScript and PDF documents. When finished, close theevinceviewer.In the Firefox browser, locate the
kexec-toolspackage subdirectory and view thekexec-kdump-howto.txtfile. This file describes important system configurations that are stored in the/etc/sysconfigdirectory.Close the document and Firefox when finished.
