Using man to get help in Linux and Unix

  • November 10, 2005
  • Read 50,553 times
 

Table of Contents

  1. Introduction
  2. Using Man
  3. How to search the man pages for a particular word or phrase
  4. Conclusion

Introduction

Many users who try Linux for the first time can get confused easily as their is no readily apparent help system available to them. As Windows programs are typically graphical in nature, it is not too hard to find the help menu for that particular program. Linux, on the other hand, has thousands of very useful programs that are run from the command line and therefore it may not be easy to find the help for that particular programs. Thankfully for us, developers created the program called man. Man, which stands for manual, is a program that can be used to view the help or manual page for the thousands of individual programs found in Linux or Unix.

For the most part, but not always, when a program in Linux/Unix is developed the developer will also create a separate man page file that contains the manual for that particular program or command. When the program is installed, the installer will also install the man page that was included into the proper location so that you can easily read the manual page as needed. This tutorial will provide a basic overview of how to use man to see the manual, or help pages, for a particular program.


Using Man


For this tutorial we teach you how to use man within the console or X-Windows Terminal program. If your *nix computer starts up automatically into X-Windows you will need to find the Terminal application and run it. This will present you with a small box with a prompt that you can type commands in. If your computer boots directly into the console, then you simply need to log in, and use the console for the rest of this tutorial.

Now that you are at a prompt, lets start learning how to use man. At your prompt type the following (please note for these exercises my prompt may look different than yours):

man

When you type man, without any arguments, and press enter you will see something like this:

$ man
What manual page do you want?
$


The reason you received this response is because man always requires an argument in order to work. For most purposes, this argument will generally be the name of the program. Now that we know this, lets look up the manual page for a popular command line program, the program mkdir. To see the manual page for mkdir we would type the following and press enter:

man mkdir

After you press enter, the man command will search for the manual page corresponding to mkdir and display it. So after typing that command you would see something like this:

$ man mkdir

MKDIR(1) User Commands MKDIR(1)

NAME
mkdir - make directories

SYNOPSIS
mkdir [OPTION] DIRECTORY...

DESCRIPTION
Create the DIRECTORY(ies), if they do not already exist.

-Z, --context=CONTEXT (SELinux) set security context to CONTEXT

Mandatory arguments to long options are mandatory for short options too.

-m, --mode=MODE
set permission mode (as in chmod), not rwxrwxrwx - umask

-p, --parents
no error if existing, make parent directories as needed

-v, --verbose
print a message for each created directory

--help display this help and exit

--version
output version information and exit

AUTHOR
Written by David MacKenzie.

REPORTING BUGS
Report bugs to .@gnu.org>

COPYRIGHT
Copyright © 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO warranty; not even for
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

SEE ALSO
The full documentation for mkdir is maintained as a Texinfo manual. If the info and mkdir programs
are properly installed at your site, the command

info coreutils mkdir

should give you access to the complete manual.

mkdir (coreutils) 5.2.1 February 2005 MKDIR(1)

$


As you can see the manual page for mkdir has extensive information. It tells you what the program does, the syntax for the command, the arguments that can be used with the command, who to report bugs found when using the program, and the copyright information for the program. With this information you should have no problem now seeing the manual for the myriad of *nix commands available.


How to search the man pages for a particular word or phrase

Sometimes you need help with a particular file or program and are unsure exactly which manual page to look up. Thankfully there is a argument that you can use with man that will allow you to search through all the man pages for a particular keyword or phrase. This argument is the -K argument. The syntax for this command is the following:

man -K keyword

So for example, lets say that you wanted to search for all manual pages that contained the word fstab, you would type:

man -K fstab

This would then return a list of manual pages that contain that word and give you the option to view it (Y), skip it (N), or quit the search (Q). To view one of the matches simply press the y button and that particular manual page will show.


Conclusion

Now that you know how to view the manual pages of *nix commands using man, get out there and explore your operating system. There are many different commands that will be useful to know. A very popular manual being intro; man intro. Man also can be fun. Try some of these man commands for some hidden surprises (may not work on all linux distributions):

man c
man poll (look in the warning section)
man sex

And if worse comes to worse, and you still need help using man, you can always type the command man man and press enter :)

As always, if you have any questions please feel free to ask them in the Linux Forum.


--
Lawrence Abrams
Bleeping Computer: Linux Tutorials
BleepingComputer.com: Computer Help & Tutorials for the beginning computer user.

Users who read this also read:

  • Introduction to mounting filesystems in Linux Image
    Introduction to mounting filesystems in Linux

    A filesystem is a way that an operating system organizes files on a disk. These filesystems come in many different flavors depending on your specific needs. For Windows, you have the NTFS, FAT, FAT16, or FAT32 filesystems. For Macintosh, you have the HFS filesystem and for Linux you have more filesystems than we can list in this tutorial. One of the great things about Linux is that you have the ...

  • Resizing and Adding Partitions using GParted Live Image
    Resizing and Adding Partitions using GParted Live

    This tutorial focuses on using GParted, or Gnome Partition Editor, a free and open source partition editor. To use GParted, you must first download the CD Image file (.iso file) of GParted Live for this program. Instructions on where to find and how to burn the GParted ISO file are covered in the Preparation step. In this tutorial we will be using Microsoft Windows XP for certain steps. If you use ...

  • Understanding File Compression and Archives Image
    Understanding File Compression and Archives

    This tutorial will focus on explaining what file compression and archives are and how to use them. This technology will not only enable you to more efficiently send attachments via email, but also save space on your hard drive and allow you to more easily back up files. To begin, lets discuss some of the terminology that will be used in this tutorial.

  • What is a File Extension? Image
    What is a File Extension?

    A file extension, or file name extension, is the letters immediately shown after the last period in a file name. For example, the file extension.txt has an extension of .txt. This extension allows the operating system to know what type of file it is and what program to run when you double-click on it. There are no particular rules regarding how an extension should be formatted other than it must ...

  • Understanding Hard Disk Partitions Image
    Understanding Hard Disk Partitions

    When a hard drive is installed in a computer, it must be partitioned before you can format and use it. Partitioning a drive is when you divide the total storage of a drive into different pieces. These pieces are called partitions. Once a partition is created, it can then be formatted so that it can be used on a computer. When partitions are made, you specify the total amount of storage that you ...

 

Comments:

blog comments powered by Disqus
search tutorials
Mandiant mWise Conference 2024

Login