As you have seen in previous examples, by default, the LHS command lists all the Non-hidden directory
files.
So sometimes this can be overkill, especially when you're just looking for information on a few files.
So fortunately, the LHS command also provides a way for you to define a filter on the command line.
So it uses the filter to determine which files or directories it should display in the output.
So before using the filter command here, let's create some files to play with the via touch command
here.
So which you will learn touch command in more detail in next lecture.
So let's actually by creating touch here.
So let's create our file names.
So my file.
Uh, Oxley Academy.
My document.
Just a picture.
And yeah, that's.
I think that's okay enough.
Yeah.
And here and as you can see here, just the picture, my document, my file and Excel Academy is created
here.
So now let's actually create another.
And another file, too.
So torch.
And in order to do that.
So let's actually create the fall fell fill and full here.
We also created this and fall fill, fill and full.
So the filter command works as simple text matching strings.
So include the filter after any command line parameters you want to use like this for here, for example,
in this case we're going to use the long here.
So now we're going to create, for example, my file here, right?
My file.
And as you can see here, we specified the name of the specific file as the filter.
So the command only shows this file information.
Sometimes you might not know the exact file name you're looking for.
And the LS command also recognized standard wildcard characters and uses them to match patterns with
the filter.
So.
So a question mark here represents one character.
So ls a question mark represents one character here.
So you can do like this.
Let's actually create.
So here, let's actually open our marker.
Oops, Sorry.
Yeah.
Let's open our marker here.
Yeah, Gromit.
And now I want to write something on here.
So firstly, as we created our files, we have, well, a file.
Firstly file.
So then we have fell.
And then we have Phil.
And also lastly, we have full here.
So let's actually what these characters and the sentences has common is that they always start with
F and the last character.
Last character is always l l here.
So in this case, if we want to filter this, we can also do this.
For example, let's yes here.
So let's create a new file.
In order to do that, we're going to do.
Yeah.
LZ, L here.
Oops.
LZ LSL.
And as you can see here, we have file fill, full fill and other documents here.
So if you want to just print those files, we need to do LZ here, Clear LSL.
So we're going to we're going to do here ls l f question mark.
And fill or LL here.
And as you can see, here we are.
This question mark, as I said earlier, is represents one character.
So this question mark represents one character.
We don't know.
But we want to search these terms here, as you can see here.
So here we added the question mark here.
So we added here f question mark and LL So this tells us that start with start for characters that start
with the F and end with the last two characters has two L's on it.
So we just want to filter this here.
So we also have the asterisks to represent any number of characters.
But here, for example, we can also do let's actually delete this.
Yeah, we can also.
So here we had the my file, my document, just the picture and let's create another here touch ox and
my Oxley.
Pouch.
Touch my Linux and LZ here.
Clear.
Firstly, LZ, and as you can see here, my document, my file, my Linux, my Excel.
So in order to do that, we're going to do here.
LZ Oops.
Yeah, LZ, L here.
So we're going to do so, as you know, here.
So we have the my.
My document.
Also we have here my file.
Also we have my Linux.
Also lastly my Oxley.
Here.
So now in order to search these files, as you can see here with the LSL command, we got like a wide
range of files.
But if we want to filter these files and the filter, that's.
Filter names that start with the my here m I or other characters.
We're going to do just this here.
So let's get here and we will do my and this asterisk and here it will show us files that start with
my so we can also do that with this here so lsl f and asterisk instead of here.
And as you can see here, we got the same result.
But actually, these are not the same.
Of course, if, for example, let's create another file, touch file fail, and here we will enter
our old command.
So clear.
Clear.
LSL And as you can see, we have failed fall field.
Fill and full.
And here we're going to do.
Yeah, we will do the previous comment here F and here WL here and as you can see we don't we don't
see our fail here because fail last two characters is not WL here.
So that's it with our example here.
In next lecture I will the talk about the handling and creating files in Linux.
So see you later.