Manual Pages#
Manual pages are a critical resource you should be very familiar with. We're going to explore the very basics of the man
command and look at some examples.
But in short, manual pages, or "man pages", are the documentation for a command or tool. The adduser
command, below, is a tool for managing system users. It has a manual page that you can (and will) review to better understand how-to use the command.
Manual pages are ideal when you're on the command line already and you need to look up a flag or some examples of how-to use a command. Just keep in mind that not everyone writes manual pages for their tools and utilities, and those that do don't always keep them up to date nor include examples.
man adduser
#
Managing users is something we'll do very shortly, but let's use the concept to see how we review the manual page for the adduser
command.
Simply typing man adduser
at the command line on our Ubuntu VM gives us this:
Note
This screenshot is from my Ubuntu VM. Yours will look similar.
What we're seeing here is information about the command, adduser
.
First, we're seeing a description of what the command does - "add a user or group to the system."
Second we get a "synopsis" of the command and all of its command line flags and arguments. Command lines allow us to change the behaviour of a command. For example, imagine we had a command called hello
that just printed the world, "Hello" to the terminal. Now imagine that command had a flag --reverse
- what might this flag do? It modifies the (default) behaviour of the command to print "olleH" instead of "Hello" when you run hello --reverse
. These kinds of flags can (generally speaking) be provided in any order.
We also have positional arguments too. These are arguments you give to the command in a specific order. In the case of adduser
there is the user
and group
positional arguments. The user
argument must come before the group
argument, like this:
1 |
|
Some arguments, flags or positionals, are optional. You'll have to read the manual page (manpage) to understand which ones.
Online manpages#
Manual pages can also be accessed online. Here's a screenshot of the adduser
manpage from the Ubuntu official website:
The link for the above is: https://manpages.ubuntu.com/manpages/trusty/man8/adduser.8.html
You can literally just Google, man adduser
and you'll get plenty of results. Just make sure they're for your OS.