Hello everyone in this with you we are going to continue our discussion on the Linux wildcards.
So in the last with you we talked about the asterisk which is a wild card that matches or represents
any characters and we also mention the question mark which is a wild card that represents or matches
any single character.
And we we now know the difference between the asterisk and the question mark.
So let's continue and deepen our knowledge about the Linux wildcards.
So right now I have as you can see many files on my desktop and I have directly one which is initially
empty.
So let's see that you're interested in a range of characters so you can specify a range by using square
brackets.
And here you put the range of the characters so what do I mean by this.
Imagine that if you want to copy all the files that begins with the lower case letters a b or c..
So if you want this you can say C-p and then use square brackets here and then here is better for your
characters ABC and then followed by anything directly one.
So what I'm saying here is that copy all the files that begins with the lower case letters A B or C
followed by anything.
I don't care about anything I just care about.
All I care about is that it begins with the lower case letters A B or C.
So if you to if you if you look here if you look here you would see that apples bananas and carrots
will be the only guys that qualify for this command.
And if I execute this command here and I go to my directory one you'd see apples bananas and carrots.
Awesome.
I'll I'll delete them now.
So here it using the square brackets you can specify a range of characters.
So what if you want to do the complement of this command if you want to execute the opposite of this
command.
So what do I mean by this.
What if you say C-p exclamation mark.
ABC star directly what.
So when you put an exclamation mark here that means that I will do the complement of this command.
Or the opposite of this command.
So what I'm saying is that copy all the files that does not begin with the lower with the lower case
letters A B or C.
So if I figure this command would you would see that it includes all the files but it did not include
apples bananas or carrots because here I said they exclude the exclamation mark here means that it does
not include.
So this command is actually is actually the complement of this command.
So if you know if you know mathematics or computer science you would know what I mean by complement
just like unions and sets and etc. right.
Because like this command plus just command covers all the files.
This is why I say the complement.
OK.
So when you say exactly exclamation mark range it means all the character that is not in this range.
OK.
So let's do another example let's say for example let's delete everything here first.
OK leader.
So let's say that you want to include all the files that begins with a number.
So for example 1G will go here this guy this again this guy and this guy and that guy.
OK.
So I want to include all these files here that begins with numbers.
So I would say C-p square brackets 0 to 9 and I don't care about anything else.
Directory 1.
And if I go here I would I would see all the guys that I talked to about any file that begins with a
number with covered so simply I can see C.P or like a number additional and then does.
Is a range right.
So when I say 0 Dash 9 it means all the numbers from 0 to 9.
However for example let's say that I have a file here called which is for example I'll call it a K and
delete everything here.
And let's say that for example I want to copy all the files from zero.
It begins with the number zero to 7 directly one
so of course if I go to the rectory one here I will not see eight because I did not include eight in
my range.
However if I put eight here
it will be included as you can see.
OK.
So that's how we can include numbers and you can specify a range of numbers.
OK let's leave this guy as well.
And let's move forward so you can also specify a class or category of characters.
So what do I mean by this let's say for example that so right now my directly with at empty right let's
say that you want to copy all the files and begins with an upper case letter.
So you could say colon or two square brackets.
Then you close the square brackets and I don't care what the end was.
All I care to hear about is the beginning of the character ok and copy the directory one.
So what I'm saying here is that copy all the files that begins with an uppercase letter.
OK so here it will cover Paris Rome London and Linux and that's it.
So it will cover Rome Linux London and Paris.
So if I could just command and open my directory one I should see Linux London Paris and Rome.
So all these guys here begins was an upper case letters.
So this is how you can do it.
And if I delete all these guys here and I said copy all the guys with lower case letters begins with
a lower case letters.
So this is very easy as well.
So if I open my directly one now I would see all the files that begins with a lower case letter.
Of course the number is here like any file beginning with a number it's not included because the number
is not considered to be a lowercase letter and the London Linux Paris and Rome are also not included
because they are not an opera.
It did not begin with an uppercase letters.
OK.
There are there there is also.
To be useful to other useful classes or categories of characters which is the desert.
So for example you can say copy Folles everything here first.
Let's say for example that you want to copy
all the files that begin with.
And actually all the files that end with a digit not begins.
I would say it
directory one.
So here it will copy all the files that ends with a lizard or a number.
So can you see any of the files.
I can see everyone actually I can see this guy 1G one.
And this guy also and 1 2 3 1 and 3 and these two guys here.
And also these guys so it will not include for example 1G.
It will not include 2G and 3G.
OK.
Let's go to the rectory one and right now we can see all the files that ends with a number or ends with
a digit as you can see so that digit is also a very famous category of class or like category of characters
right.
OK there are two more categories of classes which is the alphanumeric and the alpha
so if you said here copy all the files that begins with an alphabetic character and alphabetical like
with any any file that begins with an alphabet try and copy it to directly one.
So this will not include anything that begins with a number.
OK.
So let's see yeah.
It does not include anything that begins with a number.
However if you want to include numbers as well you can say l and you and so this will be alphanumeric.
If you go there you can see all our files.
Now so there are five categories.
There is.
Is it
also
which is alphabets.
There is.
There is also alphanumeric which includes both alphabets and digits.
There is also lower case letters
and there is also an upper case letters.
So in total we have five classes desert Alpha alphabets.
Alphanumerics lower and upper.
And these guys are very very useful as you can see.
So let's do two more examples.
Let's say for example that you want to copy.
Let's make sure that I would direct you one of the empty first.
So right now I want to copy all my files that begins with each digit.
So you have to put two square brackets digit.
And ends with each with
with an with an alphabet
OK and copy it to directly one for here I include all I copy all the files that begin with a visit and
ends with an alphabet.
So something like something like 1G and 2G and 3G.
And and that's it.
So it will.
It should include 1G one 2G and 3G.
These are only the guy that will that should be included.
As you can see so combining classes or categories of characters is very useful as you can see and you
can actually do the negation.
So you can say C-p
So here I'm saying copy of the file that does not begin with does it because you have an exclamation
mark.
No.
Yeah.
Here I have those guys from the old.
So if I delete this let's see if it leads and I execute this command again.
It will include all the files that does not begin with a number or added so you can use the exclamation
mark as well.
Here in that category the class OK let's do one more example before we end this lecture or this video.
Let's copy.
So let's first delete everything that I have
OK.
Let's say that I want to copy all the files
that begins with an alphabet.
Or actually with a lowercase letter
OK.
And ends with a different
to directly one.
So I think that begins with a lowercase letter for example Z and yet z 1 2 and 3 should be the only
guy here.
1G two and three.
OK.
So awesome.
So that's all about wildcards.
You know now about the asterisk which matches anything any character you know about this question mark
which matches any single character you know about the Rangers you know about the complement of the Rangers
we know about numbers how to put numbers here.
There are nine etc. you know about classes of characters you know about digits alphanumerics numerics
lower and upper case letters.
So right now you basically know about everything that is related to wild cards and wild cards are very
very useful and you would see yourself using them a lot if you continue to use your Linux command line.
So that's it for this video.
Ciao.