Your job will likely require you to do things you’ve never done before. This means you need to be able to research things on your own. To start with, learn to use man, the unix manual command. To start with, you can find out how to use man by opening a shell, typing man man and pressing [Enter]. That’s the manual page for the manual. Unfortunately, it doesn’t go into the generic syntax that all man pages follow. I’ll outline that here.
Structure
A man page typically has several secions; some examples include NAME, SYNOPSIS, DESCRIPTON, OPTIONS, EXAMPLES, EXIT STATUS, FILES, BUGS, SEE ALSO, COPYRIGHT, andAUTHOR. Not all those sections are in every man page, and there are some sections of man pages that I haven’t listed. At a minimum, all man pages should have Name, Synopsis, and Options, in that order. There’s no rule that says a man page must have those things - the author can put anything in there, but usually, that’s the structure of a man page.
The NAME Section
The NAME section is very simple. It looks like this:
man - format and display the on-line manual pages
It simply shows the name of the utility followed by its purpose.
Impelmentations
I’ll take a sidebar right now to point out that you might see different content on your man pages. There are sometimes many implementations of the same utility, and they can work a bit differently; because of this, there are different man pages for those different implementations.
As an example, see the man pages for the BSD project’s find and from the GNU project’s find. There are some options like -readable and -printf that the GNU version provides that the BSD version does not. And that leads to…
BSD and GNU utilities
And here’s a sidebar within a sidebar to talk about the GNU and BSD projects and general differences between them. There are many Unix and Unix-like operating systems that existed before Linux was even conceived. One of those is BSD, the Berkely Softwre Distribution; it is a full Unix operating system, including a kernel and a suite of utilites. Another of those is GNU, which stands for GNU’s Not Unix. GNU was a project that also had a kernel (actually, they had gone through several kernels, none of which the project was satisfied with) and a suite of utilities.
When Linux started becoming useful, the GNU project decided that the Linux kernel was indeed sufficient for their needs until they get a proper kernel; because of this, they worked on making their entire software suite work on the Linux kernel. Because of the early marriage of the GNU utilities with the Linux kernel, most utilities in a Linux distribuion are GNU utilities. Also because of this early marriage, the GNU project insists that the proper name for the operating system that has a Linux kernel with GNU utilities is “GNU/Linux”; some people get very upset if you refer to Linux without the “GNU/” prefix in front (unless you are only referring to the kernel). I think that’s absolutely rediculous: it’s ugly, it’s difficult to say, and it’s confusing; just call it “Linux” and be done with it. I can build an entire Linux system without a single GNU utility by substituting other utility suites (such as Busybox), and it’s most definitely not GNU/Linux at that point.
Anyway, there is a generic pattern that the BSD utilites are simpler and the GNU utilities offer more features. Some people prefer one over the other. There is a Unix philosophy that says software should do one thing and do it very well - some people think the BSD utilities follow this philosophy better than the GNU utilities and that the GNU utilities are unnecessarily complex. People who prefer the GNU utilities can point out circumstances where a feature (such as find’s -printf can save several lines of complex shell script that would be needed to compensate for the missing feature. Most people find it doesn’t really matter - they just use the tools that are on whatever system they are using. Additionally, there are other people for which it doesn’t matter particularly that a utility has or doesn’t have a feature - the problem for them is that they are charged with writing scripts that use those utilities and those scripts have to work on multiple systems with varying utility suites - and that can be a real pain, especially when utilities have the same option name for different features or different option names for the same feature. Most of the scripts I write do not have to work on multiple systems, but every once in a while, they do, so I’ve adapted the policy of trying to be aware of common problems and avoiding them in all my scripts so that surprises are less common. Answering questions on the Unix & Linux Stack Exchange is a good way to find these problems. I usually test my answers on a Linux system with GNU utilities, a BSD system, and a Linux system with Busybox utilities - even so, sometimes there is a problem with my answer on an Oracle system, for example. Usually, people will point out the problem in comments and that is a great learning experience.
The SYNOPSIS Section
The synopsis section describes the invocation syhntax. It looks like this:
man [-acdfFhkKtwW] [--path] [-m system] [-p string]
[-C config_file] [-M pathlist] [-P pager]
[-B browser] [-H htmlpager] [-S section_list]
[section] name ...
The italicized words are placeholders - those are phrases that you have to replace. The straight leters are literal - you would actually type that as part of the command. Any part in square brackets [...] is optional. Here, you can see that to invoke this command, you must type “man” and a name; everything else is optional. When we typed man man, we replaced name with man, and we did not use any options.
Sometimes, the Synopsis will not list out all the options as demonstrated above, they will simply say [OPTIONS] and later (in the OPTIONS section) list out every option. Additionally, sometimes only the most common options or only the short options are shown in the synopsis.
The OPTIONS Section
The OPTIONS section lists al the options, explains what they do and what arguments each option might take.
-P pager
Specify which pager to use. This option overrides the
MANPAGER environment variable, which in turn
overrides the PAGER variable. By default, man
uses /usr/bin/less -is.
Here, -P is the option, and it takes an argument, pager. This particular option is for specifying what program to use to display the man page. more is another pager utility that is commonly available on Unix systems. You could call this command like so: man -P more man to view the man page using the more pager. The more pager has fewer features than the less pager, so a funny joke is less > more.
Sometimes, an option will have more than one name - usually a short name and a long name, those are shown like so:
-k, --apropos
Equivalent to apropos. Search the short
manual page descriptions for keywords
and display any matches.
See apropos(1) for details.
This option can be invoked using either -k or --apropos.
By the way, that particular option mentions another command, apropos that is very useful. It can be used if you don’t know the name of a utility, but you have some idea of what you want to do. For instance, maybe you want to rename files, but you tried rename banannas.jpg karen-holding-bannanas.jpg and the shell complained that rename wasn’t found. Try apropos rename, and you’ll see one of the available man pages is mv (1) - move (rename) files - that sounds perfect!
Conclusion
Once you learn how to read and understand man pages, a whole world opens up. If you’d like an excersize to help you learn to read man pages, go to sprunge.us and learn how the command they suggest works. Use only man pages to figure it out - then, also using only the man pages, figure out how to do the same thing using the wget utility.