Bookmark this page

Lab: Get Help in Red Hat Enterprise Linux

In this lab, you 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

  1. On the workstation machine, determine how to prepare a man page for printing. Specifically, find which is the default format or rendering language for printing.

    1. Use the man man command to determine how to prepare a man page for printing.

      [student@worksation ~]$ man man
      ...output omitted...
        man -t bash | lpr -Pps
            Format 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 man command -t option prepares a man page for printing, using by default PostScript.

  2. Create a PostScript-formatted output file of the passwd man page. Call the file passwd.ps and place it in the student user's home directory. Determine the file format. Inspect the contents of the passwd.ps file by using the less command.

    Note

    Because you need to save the output of the man command 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-names

    This command is taught in more detail in a following chapter.

    1. Use the man -t command to create a formatted file of the passwd man 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...
    2. Use the file command to determine the file format.

      [student@workstation ~]$ file /home/student/passwd.ps
      /home/student/passwd.ps: PostScript document text conforming DSC level 3.0
    3. Use the less command to view the /home/student/passwd.ps file.

      [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 file states 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 the less command.

  3. By using the man pages, find which commands you can use for viewing and printing PostScript files.

    1. Search in the man pages for information about PostScript files. Use the -k option for this purpose.

      [student@workstation ~]# man -k postscript viewer
      enscript (1)         - convert text files to PostScript, HTML, RTF, ANSI, and overstrikes
      eps2eps (1)          - Ghostscript PostScript "distiller"
      evince (1)           - GNOME document viewer
      evince-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 -k option finds man pages that match any word; such as "postscript" or "viewer" in their descriptions. Notice the evince(1) commands in the output.

  4. 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 using evince three 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.

    1. Use the man evince command 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 opens evince in preview mode. The -i option opens evince at the specified starting page.

    2. Use the evince command to open the /home/student/passwd.ps file.

      [student@workstation ~]$ evince /home/student/passwd.ps
    3. Use the evince -w /home/student/passwd.ps command to open the file in preview mode.

      [student@workstation ~]$ evince -w /home/student/passwd.ps
    4. Use the evince -i 3 /home/student/passwd.ps command to open the file at page 3.

      [student@workstation ~]$ evince -i 3 /home/student/passwd.ps

      Note

      Whereas the normal evince mode supports full-screen and presentation-style viewing, the evince preview mode is useful for quick browsing and printing. Notice the print icon at the top.

  5. 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.

    1. Use the man lp command 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 -P option specifies the page list to print in the document. The lp command spools to the default printer, and sends only the page range to start on 2 and to end on 3. Therefore, one valid answer is lp passwd.ps -P 2-3.

  6. Use the Firefox browser to open the system's man page directory (/usr/share/doc) and browse to the man-db package subdirectory. View the provided manuals. After you finish reviewing the man-db manuals, locate and browse to the kexec-tools package subdirectory. View the kexec-kdump-howto.txt file, which describes important system configurations that are stored in the /etc/sysconfig directory.

    1. Use firefox /usr/share/doc to view system documentation. Browse the man-db subdirectory. Click the manuals to view them.

      [student@workstation ~]$ firefox /usr/share/doc

      Note

      You can create bookmarks for any frequently used directory. After browsing the man-db directory, click to open and view the text version of the manual, and then close it. Click to open the PostScript version. As observed earlier, evince is the system's default viewer for PostScript and PDF documents. When finished, close the evince viewer.

    2. In the Firefox browser, locate the kexec-tools package subdirectory and view the kexec-kdump-howto.txt file. This file describes important system configurations that are stored in the /etc/sysconfig directory.

      Close the document and Firefox when finished.

Evaluation

As the student user on the workstation machine, use the lab command to grade your work. Correct any reported failures and rerun the command until successful.

[student@workstation ~]$ lab grade help-review

Finish

On the workstation machine, change to the student user home directory and use the lab command to complete this exercise. This step is important to ensure that resources from previous exercises do not impact upcoming exercises.

[student@workstation ~]$ lab finish help-review

This concludes the section.

Revision: rh124-9.0-398f302