- In this video, we are going to talk about man.
What is man?
Man is the System Programmers Manual.
And you know, it goes all the way back to the early 1970s
when the first Unix systems were introduced
and the developers created the man pages actually
on a typewriter.
And if you ever go to Mountain View in California
you can still see them in the Museum of Computer Science.
Very interesting.
Nowadays, it's not printed pages anymore.
It's an online system that you can use
by accessing the man command.
The man command is very important.
You should make sure that you are very familiar with it.
And that is because the man command is the main
but not the only source
for getting information about Linux command usage.
Now, the thing is that Linux is open source
and in open source, you have people who do what they want.
The result is that very frequently in Linux
you will see different solutions for the main problem.
But if one solution is really better than the other ones
it will become the dominant solution.
And that is what has happened with with man.
So man is the main source
for information about Linux command line usage.
And you use it to get information
about commands, configuration files and more.
Before I show you all the information on the next slide
let me already give you an impression
of what man is all about.
So here we are.
And let me, let me type man who am I.
I'm starting with a simple command.
And what do we see?
We see a man page that actually fits on one page.
And there's not many of them as you will discover later.
So what do we see?
First line, this is the header line.
And isn't that surprising?
Do you remember what I said
about Linux being case sensitive?
Well, from that perspective, it's kind of weird
that the first line is the header line
and we see the command in uppercase.
And that is so for all the items that are documented in man.
That's a tribute to history.
The original man pages were created on a typewriter
and on the typewriter, the author used uppercase
for the command on the first line.
Behind the command, who am I we can see the number one.
Number one is about the man section.
Man is organized in sections
and we should try to understand these sections
but we'll do that later.
For now, let's have a quick glimpse
of what we see right here.
So we have name.
That's the name of the command
including a short summary of what the command is used for.
Now, we have the synopsis.
The synopsis is the name
of the command followed by option.
Now look at the way, how option is written.
Option is written between square brackets.
If in men output or in help, output in general
anything is between square brackets that means
that it is optional.
Which means that you can use it.
You don't have to use it.
It's not mandatory.
So you can use options
and the options are listed right here.
It's not very much in the who am I command
as we have seen before.
Behind the option, we have dot dot dot.
Dot dot dot is a modifier of what you see before the option.
It means that you can have multiple of them.
So you can use who am I with one option
or with many options.
And then you get the additional information, the author,
the reporting books, the copyright, and also the see also
which is telling you that this is not the real information.
You should use the info command
to get access to the real information.
I'll tell you about that later.
For now, I want to show you another man page.
And that is man, man.
Oh, yes, man itself has a man page as well.
It's a little bit more complicated.
And I want you to understand what we see.
It starts with the synopsis
and in the synopsis you can see the different uses of man.
So we can use man with man options, which are optional
which specific sections and pages
in which section is optional to the page
in which you can have multiple
of them and multiple of the preceding item as well.
Wow, is that difficult to read?
I think it is, but this is the man page of man.
And I would say
if you wanna know more about it, just continue reading.
You will find the explanation in the description.
What you also need to know is
that here we have different use cases.
So you can use man minus lowercase K, man minus uppercase K,
minus F, minus L, minus w.
And all of these are documented further in the man page.
Hey, this is an interesting one.
We should explore this one as well.
So minus w in lowercase, as well as uppercase.
What is this construction with the pipe sign in the middle?
Well, this construction with the pipe sign
in the middle means that you need to select one of them.
You can't use both.
So it's either minus lowercase w
or minus uppercase w to do whatever you want to do.
You will also notice that this minus w is sometimes written
with curly braces around it.
So man curly brace minus w pipe minus w closing curly brace.
It's exactly the same.
Now, the reason that we are really here is
because of the section numbers.
Here, we have the sections.
How should you see that?
See it as chapters in a book
and every chapter is defining its own things.
Here we have section number one, which is
for executable programs or shell commands.
Section number one.
This is commands that you can use as an ordinary user.
There is section number eight.
That's the other one that is very important
which is about sys admin commands.
So what does that mean?
That means if you see a man page
with an eight in the header line
that you better prepare your sudo session
because what is documented
in section number eight requires sudo superpowers.
And there is section number five
which is about file formats and conventions.
Now, what is this file formats and conventions?
Well, very simple.
That's about configuration files.
One, five, and eight.
These are the most important ones.
And in case you want more information about everything else
have a look at what you see here.
This is what is explaining how man is actually used
and how these placeholders and the options
and all the different alternatives are actually used.
Let me use Q.
Q to get out of here.
Q for quit.
Q for quit is a very generic Linux command
to get out of surf.
And let's get back to the slides
because I have some more information
about man on the next slide.
So here is what is on the slide.
So in a man page
you will find a command summary.
Command summary, it's showing you how to use a command.
And we have seen the items between brackets are optional.
And if you see curly braces, a pipe b
you must choose and as discussed
sometimes the curly braces are missing.
And dot dot dot means
that you may have more of the preceding item.
Now we have seen in the sections.
That we have seen that section one is for end user commands.
Section eight is
for administrator commands or root commands.
Anything that requires you to type sudo in front.
And then there is section five
which is for configuration files.
Many man pages have examples near the end.
And that is pretty awesome.
It makes working with Linux a lot easier
especially if the command is becoming more complex.
You will see that simple commands don't have these examples.
More complex commands do.
And otherwise they will have related items
near the end as well.
And that is convenient if you are looking for a command.
You were in a man page
but it's just not the right command.
Then you will have look at the related items
to find the actual command that you needed to use.
In man pages you can search.
So slash some text will search for some text.
And you can use Q to get out of the man page.
Before we are moving on one more small demo
about these man pages.
So this time I'm having a look at man LV create.
At this point, we totally do not care
about the LV create command.
The thing that I want to show you here is the nice way
how it is formatting all of its output.
Like this highlighted line, for instance, which is
about the command line option minus a or alternatively minus
minus activate, and these
or regardless which one you are using, have
a yes, a no, or an all yes, separated by pipes again.
So I'm using the space bar to move forward.
And there we go.
We have some usage examples about this lvcreate.
Usage or examples.
It's really basically the same.
But lvcreate is so big a command
that they included the separate section with the name usage.
And look at that.
We even have some advanced usage.
Just giving you an impression
of how rich this environment is.
And there we go, the examples.
Examples is what you find
in more complex man pages.
And if you go further, what else do we have?
We have see also.
If lvcreate happens to be not exactly what you need
then see also is giving an overview of related commands.
You might find what you need right in there.
Okay, now I'm going to use the G key.
G for go all the way to the top, because I want to show you
and look at the lower left corner.
I want to show you how you can search
for text in a man page.
So I'm using slash write, which will search
for the text write in the man page.
And there you see,
that the first occurrence of the word is highlighted.
If you need to see the next press N
and N and N until you found what you were looking for
and once you are ready press Q to get out of here.
That's how you use man.
Let's continue with the next topic.