Bookmark this page

Guided Exercise: Reading Manual Pages

In this exercise, you will practice finding relevant information by using man options and arguments.

Outcomes

You should be able to use the man Linux manual system and find useful information by searching and browsing.

Log in to workstation as student using student as the password.

On workstation, run the lab help-manual start command. It creates a file called manual.

[student@workstation ~]$ lab help-manual start
  1. On workstation view the gedit man page. View the options for editing a specific file using gedit from the command line.

    Use one of the options from the gedit man page to open the /home/student/manual file using gedit with the cursor at the end of the file.

    1. View the gedit man page.

      [student@workstation ~]$ man gedit
      GEDIT(1)    General Commands Manual      GEDIT(1)
      NAME
             gedit - text editor for the GNOME Desktop
      
      SYNOPSIS
             gedit [OPTION...] [FILE...] [+LINE[:COLUMN]]
             gedit [OPTION...] -
      ...output omitted...
    2. In the gedit man page, learn the options for editing a specific file from the command line.

      ...output omitted...
            FILE  Specifies the file  to open when gedit starts.
      ...output omitted...
            +LINE  For the first file, go to the line specified by LINE (do not insert a space between the "+" sign and the number). If LINE is missing, go to the last line.
      ...output omitted...

      Press q to quit the man page.

    3. Use the gedit + command to open the manual file. The missing line number next to + option opens a file passed as an argument with cursor at the end of the last line.

      [student@workstation ~]$ gedit + manual
      the quick brown fox just came over to greet the lazy poodle!

      Confirm that the file is opened with the cursor at the end of the last line in the file. Press Ctrl+q to close the application.

  2. Read the su(1) man page.

    Note that when the user is omitted the su command assumes the user is root. If the su command is followed by a single dash (-), it starts a child login shell. Without the dash, a non-login child shell is created that matches the user's current environment.

    [student@workstation ~]$ man 1 su
    SU(1)              User Commands                      SU(1)
    NAME
        su - run a command with substitute user and group ID
    
    SYNOPSIS
        su [options] [-] [user [argument...]]
    
    DESCRIPTION
        su allows to run commands with a substitute user and group ID.
        When called without arguments, su defaults to running an interactive
        shell as root.
    ...output omitted...
    OPTIONS
    ...output omitted...
    -, -l, --login
         Start the shell as a login shell with an environment similar to a real login
    ...output omitted...

    Note

    Note that comma-separated options on a single line, such as -, -l, and --login, all result in the same behavior.

    Press q to quit the man page.

  3. The man command also has its own manual pages.

    [student@workstation ~]$ man man
    MAN(1)             Manual pager utils                                 MAN(1)
    
    NAME
      man - an interface to the on-line reference manuals
    ...output omitted...
    DESCRIPTION
           man is the system's manual pager. Each page argument given to man is
           normally the name of a program, utility or function. The manual page
           associated  with  each  of these arguments is then found and displayed.
           A section, if provided, will direct man to look only in that section
           of the manual.
    ...output omitted...

    Press q to quit the man page.

  4. All man pages are located in /usr/share/man. Locate the binary, source, and manual pages located in the /usr/share/man directory by using the whereis command.

    [student@workstation ~]$ whereis passwd
    passwd: /usr/bin/passwd /etc/passwd /usr/share/man/man1/passwd.1.gz /usr/share/man/man5/passwd.5.gz
  5. Use the man -k zip command to list detailed information about a ZIP archive.

    [student@workstation ~]$ man -k zip
    ...output omitted...
    zipinfo (1)          - list detailed information about a ZIP archive
    zipnote (1)          - write the comments in zipfile to stdout, edit comments and rename files in zipfile
    zipsplit (1)         - split a zipfile into smaller zipfiles
  6. Use the man -k boot to list the man page containing a list of parameters that can be passed to the kernel at boot time.

    [student@workstation ~]$ man -k boot
    ...output omitted...
    bootctl (1)          - Control the firmware and boot manager settings
    bootparam (7)        - introduction to boot time parameters of the Linux kernel
    bootup (7)           - System bootup process
    ...output omitted...
  7. Use the man -k ext4 to find the command used to tune ext4 file system parameters.

    [student@workstation ~]$ man -k ext4
    ...output omitted...
    resize2fs (8)        - ext2/ext3/ext4 file system resizer
    tune2fs (8)          - adjust tunable filesystem parameters on ext2/ext3/ext4 filesystems

Finish

On workstation, run the lab help-manual finish script to complete this exercise.

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

This concludes the guided exercise.

Revision: rh124-8.2-df5a585