Hello, the beautiful people.
Knowing the last video you learned about the structure of the Linux manual and you saw the way that
it was broken up into eight sections and those eight sections each deal with a different part of the
Linux experience.
Now we're going to take that theory from the last video and we're going to turn it into practice in
this video.
So in this video, you're going to learn how to search the manual and discover new commands.
You can learn how to access the manual pages for those commands, and you're also going to learn how
to read them so that you can go out there and independently learn how to use new stuff.
So by the end of this video, you'll have the independence to search for new commands and learn about
how they work.
And this is going to put you in the driver's seat because it makes it possible for you to gain more
control over your Linux system because you can start learning independently about how everything works
rather than waiting for random changes that you randomly bump into learning new commands.
So you can take a lot more of an active role in your learning and your development of the Linux operating
system.
So let's go ahead and get right into it.
Okay.
So now that you know that the manual is broken up into eight sections, how would you know what section
to look in to find what you're looking for?
Well, let's say that you wanted to look up information about the Witch Command.
First to search the manual, you would have to use the man command.
Now, the man command is short for the word manual, and it's the command that deals with everything
to do with the manual, basically.
And this is why they're actually called man pages, because it's the man command that looks through
the manual.
Now, that's the command name.
So we're good at that.
Now we need to give it any options if necessary.
We're actually going to use the Kay option, which is what deals with searching.
So we've got command name, then options.
Now it needs an input and the input that we're going to give it is the search term.
So we type which so we've got a command name, we've got our options, we've got our inputs.
The same general structure that I was telling you about before.
But now what we're doing actually is we're using the man command to search the manual for this search
term, this search term here called which.
And it's going to look all the way through the manual and find anything that might be relevant to that
search term.
It's like your own mini search engine for your manual.
So if I press enter, we get quite a few lines of output here.
So let's let's have a look at what this is on the left here.
You're going to get the names of certain manual pages.
So every single one of these is a manual page that is appropriate to this search term.
And on the right, you get a bit of a synopsis about that actual page so you can pick which one might
be most appropriate.
And the other thing is in the parentheses here, you get the section number of the manual that that
page is in.
So, for example, this command, this this manual page is in the first section of the manual, which
means it's a user command, whereas this one is in the eighth section of the manual, which means that
it is a more system, administrative kind of thing.
And this one is a in section five, which is going to be about file, file configuration, how the files
are structured and things like that, information about how files are structured.
So there we go.
We can actually see at a glance whether it actually suits our needs or not.
And if we decide that we want to take a further look, it seems like this one is exactly what we're
looking for.
It's in the user command section and it's a command that locates a command.
We can actually take a deeper look at that by using the main command again, then the section number.
So the section number is one and then we type the search term.
Oh, sorry, the page name which is on the left there, which is which.
And if I press enter Dada, we've opened up the manual page for the Witch Command.
Now it's only very small and once we've opened that to close it and get back out, we just press the
Q key on the, on the keyboard.
So I press the letter Q and I'm back out on my command line.
So, for example, we could open up this soul section here, this soul thing by doing Man six because
it's section six.
So and I press enter and it opens up that, that manual page for soul, which you can see at the top
right there now because the first section of the manual is used so often, you don't usually have to
type the number one.
Even so, instead of typing man one which as a nice shortcut, I can just type the word man, I can
just type man which, which will open up the same page, the same manual page.
And you can see that it is indeed in section one.
So that's a shortcut.
If you see that something is in Section one, you don't need to type the one, you just type the actual
name of the page.
So like up here we've got LCF, right?
LCF is in section one I type man LCF and we see that we are now in the LCF man page in section one,
which means that it's a user command.
So that's how you would open up a manual page.
And up next now we're going to take a look at how you would actually read it.
Okay.
So let's take a look at the man page for the Witch Command.
So I'm just going to type man and then which and because it's actually a command that I've used very
recently, I could have just pressed the up arrow key a couple of times and I get back to the same result.
So I press man which press enter and we've opened up the manual page.
Now we can see that this manual page is actually broken up into the following sections at the top.
We've got name, then we've got synopsis, then we've got description, then we've got options, then
we've got exit status.
Okay, now other sections that a man page may include are examples, a C, also section and environment
section.
Things about bugs, things about authors, things about reporting bugs, history of the command, copyright
things, stuff like that.
But this is what we get in this specific manual page.
So they're not always structured the same way, but they usually follow this kind of structure.
Okay, now in the name section, we see that we are dealing with the Witch Command and we see a little
bit about what it does.
And this bit is actually what came up when we searched the manual in the first place.
This is exactly what came up.
We saw the name and then we.
Had this little piece of information on the right hand side.
Um, now in the description section, this is where you, this is where you really see what the command
does.
And the description section is a very important section, and it gives you a much more in-depth description
of what the command actually does.
This is likely going to be one of the most useful parts of the main page for any command, and as it
will try to explain what the command does in plain English.
Okay, so you've got the which command description there and up here you've got the in the synopsis
section, we can see a layout of how to actually use the command.
A Ha.
So you remember when I was telling you that each command is structured differently and you need to read
the manual pages to see how to use a command?
Well, this is the section of the manual page that will tell you how to use the command, the synopsis
section.
So for the Witch Command, we can see that first we type which the command name and then we see the
a option in some square brackets which we'll come onto in a minute and then some kind of file name and
then three dots or other also known as an ellipsis afterwards.
So let me explain what this stuff means.
So first we enter the which command name we just type, which then we have the a option which is optional.
Now we know it's optional because it's inside these square brackets in a man page.
If something is inside square brackets, that means it's optional.
You don't have to enter it, but you can.
Now, next after that, once we've entered our optional option, we next you have to enter the name
of a command that you're actually looking for.
Now you can see so so you enter a name of what you're looking for.
So for example, which may be Dash A and then echo.
Okay, that would show you where the Echo command was.
But you also see this ellipsis or these three dots.
Now, these three dots mean that you can enter more than one file name.
So in other words, the which command can take more than one input?
Ha.
Things are starting to fall into place now.
Right?
So how do you know how many inputs a command takes?
Will you look at the man page?
You look at the synopsis, and it will tell you how many inputs it takes.
Okay.
Now, just to prove it.
Okay, just to prove this, we're going to take what we've learned here and we're going to apply it.
Okay.
So I'm going to go back I'm going to clear the screen press by holding control now.
And we're going to see we're going to try and use the which command to find the date command and the
command at the same time.
So we've used the which command.
We didn't give it the a option, but we didn't have to because it's just option, just optional because
we because it was in the square brackets and we've given it a one file name and then another file name.
So if we press enter Dada, we see that we get two outputs and that it's found the locations of the
date command and then the Cal Command.
We didn't need to run the command twice because if we look at the main page, it tells us we can actually
give it more than one file name.
So that's really, really useful.
And maybe not.
Maybe something we wouldn't have known had to do if we had not looked at the main page.
And as I said, the things inside square brackets in the main page, let me open up again.
Things inside the square brackets are optional.
This kind of stuff you don't have to have, but you can have.
And if you want to know what it does, you just go to the options section.
So if I put in the A option, it says it'll print all matching path names of each argument.
So all matching path names.
So A is short for all.
So what I could do is I could type, which I could do which date and cow, but I could type dash a and
see if that does any difference.
It actually it doesn't make any difference, but it will show us all of the different all of the different
results.
So maybe, you know, when I told you about searching from searching on the path, maybe this would
allow us to look in folders that were later on in the path if they had the same name as where they were
earlier on.
So there we go.
Now there's other symbols in the manual pages, such as angle brackets.
So these kind of things, right?
So if you have something inside here inside a manual page, so if we had like which and then it was
like this and then you had something inside angle brackets, anything inside the angle brackets is mandatory.
That means you have to have it.
Okay.
So if you see something inside angle brackets, that means you have to have it and you can't miss it
out.
All right.
So just bear that in mind.
There's also the pipe character.
So if I had an option here and it was something like, say, you had the F option because there's a
pipe character between the two options, that means that you have to pick one or the other.
Okay, so the pipe means one or the other.
You cannot have both.
So I couldn't type I couldn't type a which which does a f date.
I would have to type which dash A or which does F.
I couldn't have both.
That's what happens if you see something inside inside angle brackets.
So I'm just going to type my finger again, angle brackets with a pipe in between them.
Okay.
So what we're doing so far.
Okay.
It's probably what you'll come up with most of the time.
So these are all the different things that you'll see.
You'll have the command name.
You have some options.
It'll tell you which ones are optional and which ones you need and which ones cannot be combined with
others.
You'll see things that maybe are mandatory inside square brackets.
Anything with a dot, dot, dot after it means you can have more than one thing.
So if it had like this, it was file name, wasn't it?
And then dot, dot, dot, that means you can have more than one file name when you use this command.
Now I'm actually going to put a PDF in the resource in the resource section for this lecture that lists
out what the different symbols mean.
So you can use it if you ever need a quick refresher.
But that's pretty much all you need to remember.
Okay.
Just the anything in square brackets is optional.
Anything with a pipe in between it, you can only have one or the other.
Anything in square, anything in brackets is mandatory.
And I think with dot, dot, dot after it, you can use more than once because that's pretty much all
you need to know.
And if you want to know how to look up what different options do, just scroll down to the options section
in the main page and it'll tell you exactly how to use them all.
Okay, awesome.
So we've covered a whole lot of stuff in this video and you should start feeling a lot more comfortable
using the command line.
Already in this video, you saw how to search the manual using the man command with the K option, and
after that you can give it any search term that you want and the man command will search the manual
for that search term and give you a list of results as well as what those results are and where section
of the manual page they're in.
You saw how to access those specific manual pages and also how to read them for specific command structure.
So we saw how how to actually use the which command using its manual page and we saw the different symbols
that might come up in the manual page and tell you how to use it.
But I've attached to cheat sheet in the resources section for this video that I massively encourage
you to use and keep on hand, because it's going to give you an explanation of each of the different
symbols that might show up in a manual page so that you can keep that to hand and make sure that you
don't forget anything but to ensure that you don't forget anything.
Up next, we're going to have some practice.
What we're going to do is we're going to go together and we're going to look at we're going to search
for a new command and we're going to read about how it works.
We're going to look at its manual page, and we're going to take that learning and actually apply it
and show you how the how you would take a man page that you've never seen before and learn how to use
it.
So we're going to be applying what we've learned in this lecture about reading manual pages and apply
it to a completely new command and go through it together.
And after that, you should definitely feel as though, hey, any command or any manual page that I
come up against, I'll know how to read and know how to use, which is going to give you a massive boost
of confidence and a massive boost of independence for you to explore and learn more about the Linux
operating system.
So let's go ahead and jump into the next video and get some super, super cool practice.