Linux has many different ways
of accessing documentation that will help you go through
and understand all the key functions of Linux.
Now, there's online help,
there's FAQs, mailing lists,
there's also manual pages inside of Linux itself.
Today we're going to focus a lot on the manual function
and we're also going to use an example
to have a test case
to get the best option for our organization.
The first command we're going to test out
is the apropos command.
Now, the purpose of the apropos command
is to allow the user to search through all the manuals
for a keyword and a description
or synopsis of a manual.
For example,
you use apropos search.
Now, if you look at the results here,
you will see that the apropos command uses the search
and it parses through all of the commands
that can potentially use a search function.
And it gives us a list to the left of the commands
and the descriptions to the right,
that allows us to pretty much do a search function.
Now again, Linux is very complex,
and it can get very in-depth
with a lot of different search features
tailored to our organizations
or what us, as Systems Administrators, need to do,
and try to get the best results for us.
Now, another example we're going to use
is one that uses the apropos,
but this time I'm going to use pattern.
Now, we see we also have another set of commands
that could search for patterns
within, just say, file contents or logs.
It's going to be very useful for us as Systems Administrators.
Now, for this example, we're going to use grep.
We're going to focus a lot on the grep command,
which is very useful and it's used a lot
as a Systems Administrator.
At this point,
we're going to test out the man command on grep.
Grep searches the named input files,
or standard input if no files are named,
or if a single hyphen minus is given as a file name,
for lines containing a match to the given pattern.
By default, grep prints the matching lines.
So we see grep uses a pattern,
and we can get all this information from the description.
We'll look at the synopsis.
You see grep, options, the pattern, and a file.
So as you go through,
you'll see all the available options
and then the pattern is what you're looking for,
typically a string.
If you want to look for a specific file
or look through a specific file,
that's where you will insert that value there.
Okay, we're just going to scroll down.
See all the available options here?
Now, it's very similar to the less command
where you use space,
page up, page down.
As we see, grep is pretty extensive.
It's a lot of different information,
a lot of different commands
that we can use for this thing, all right?
Now, when we're using the manual,
we can use forward slash case.
It's going to be example, we're going to search the manual
for the instance of the word case.
All right, so we see every instance
of case used in the manual.
The dash i will ignore
the case of the word that we're using.
So that means it doesn't matter
if it's uppercase or lowercase,
it will return the line of the file based off the word,
and it's case insensitive.
And we press the N
to go to the next indication of the word case in the file.
Looks like there's no more.
Now we can do
Shift N to go back if we need to.
Little gee whiz there.
Now we have a little information about grep.
This is a good example.
Let's test it out.
Use the I option.
Remember that means sed.
I'm just going to search for
any word,
ignoring the case.
I'm going to use my file.
It's going to return any line in that text
that contains those characters.
And we see that ran through successfully.
Now let's look up some more information about grep.
So we're going to go to usr,
share, slash,
doc directory.
And this directory contains a lot more information
about different commands we would like to look into.
So as we see,
this is a catalog of all the documentation relative
to different commands and their versions.
So we're going to search grep here
and remember to use our trusty tab command.
Let's see
CD, sorry,
grep with a tab here.
So now we'll go to this directory, list all the contents.
And now we see we have all the documentation for grep
within this directory here.
Now let's get the news,
see what it has to say for us.
All right. So we're able to look at
documentation information about grep.
This is a lot of good information that you can use directly
on the command line without having to search
any third party files or anything like that.
Bug fixes, things of that nature.
All right, let's get out of here.
To conclude, we just used the manual function
to help us look up some information
about different commands.
For this example we used grep,
which is something that you're going to use very often
as being a Systems Administrator, especially for Linux.
So I hope this helps
and I'll see you again in the next video.