Bookmark this page

Guided Exercise: Read Manual Pages

Practice finding relevant information by using man options and arguments.

Outcomes

  • Use the man Linux manual system and find useful information by searching and browsing.

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-manual

Instructions

  1. On workstation, view the gedit man page. View the options for editing a specific file by using gedit from the command line.

    Use one of the options from the gedit man page to open the /home/student/manual file by 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.

      OPTIONS
      ...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 the ` option opens a file that is passed as an argument with the cursor at the end of the last line.

      [student@workstation ~]$ gedit + manual
      this is the first line
      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.

    If you omit the user argument, then the su command assumes that the user is root. If the su command is followed by a single dash (-), then it starts a child login shell. Without the dash, the su command creates a non-login child shell 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 with no user specified, 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

    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. Open the man(1) command manual page.

    [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. The /usr/share/man directory contains all man pages. Locate the binary, source, and manual pages for the passwd utility by using the whereis command. Verify that the /usr/share/man directory contains the man pages for the passwd utility.

    [student@workstation ~]$ whereis passwd
    passwd: /usr/bin/passwd /etc/passwd /usr/share/man/man1/passwd.1ossl.gz /usr/share/man/man1/passwd.1.gz /usr/share/man/man5/passwd.5.gz
  5. Use the man -k zip command to list the man page with 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 command to list the man page with a list of parameters that can be passed to the kernel at boot time.

    [student@workstation ~]$ man -k boot
    binfmt.d (5)         - Configure additional binary formats for executables at boot
    bootparam (7)        - introduction to boot time parameters of the Linux kernel
    bootup (7)           - System bootup process
    ...output omitted...
  7. Use the man -k ext4 command to find the command 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 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-manual

Revision: rh124-9.3-770cc61