Wild are what are wild cards, just as his name says, they are wild cards, meaning if you play cards.
And, you know, in in poker or blackjack, they do pick a card like 10 or nine, whatever the card,
and you could match it to any of the card to make your flash trail or whatever that you like.
So that is kind of a wild card.
So just like that, in Linux, we use wild cards to get the output that we are looking for.
A wild card is a character.
Now, this is a definition right from the Lennix dictionary that can be used as a substitute from any
of a class of characters in a search.
So there are many wild cards, but the most basic ones I have listed here, there are three.
The first one is the one I use most of the time is Asterisk, which is also referred to as a star.
A star represents zero or more characters, anything that matches that star placeholder.
We'll look into that in a moment when we actually use the star wild card in our Linux machine.
Then we have Questionmark represents a single character.
So if you have a file, name, text and you are looking for any files that has the word text and you
could use T, E instead of X, you could just put questionmark in there and then T, that means whatever
files that had t e doesn't matter what's inside of that X and the last letter is a T then don't work.
The third one we have brackets which represents a range of characters.
So it's better we look at the Linux machine to understand them more deeply and logged in hallways as
myself and I'm in my home directory of course now right now these are the files and directories and
exist in my home directory.
I want to create nine files that has a name, let's say ABCDE one and X, Y, Z and then same thing
instead of one.
It just increments the number two, three, four or five, six.
I could do this, touch a, b, c, d one dash x, y, z one time then hit up our key again.
Chain wanted to change two to three and keep going.
But don't you think it's cumbersome.
Tedious.
It is way.
So we use wild card to perform that task because you're going to create nine files.
So it's just a practice that we are doing four nine files.
Trust me, in a corporate environment you're probably going to have to create like thousands of miles.
What are you going to do?
You're going to just hit a Parakey and type it thousand times.
No, that's not productive.
So then what do you do?
We use wild cards.
So first of all, I'm going to do is I'm going to remove these files one by one again.
I can remove the wild card as well.
But let's create it first, then I'll show you how I can remove it.
So I have two left now.
I could use a wild card to remove both in one shot, remove ABC Wild Card.
So what is telling it?
Remove everything that has a file name that starts with ABC and whatever that comes afterward.
You don't care.
Just remove it.
Hit enter.
That's my LTA and you'll see all those two files are gone.
Now I'm going to create nine files and to create nine files.
I'll use the command touch as you know, the touches of command to use.
And then there is a wild card, another wild card that's called curly braces.
So I was creating file abcde curly braces one dot dot nine because I'm going to create nine files.
So this curly braces one nine seven create nine files.
That has the digit one through nine and dash X, Y, Z.
When I run this command, what do you think that I will have listed in my home directory?
I will have nine files right here at the bottom.
You'll see.
I have nine files, awesome, right?
This is what you wanted to do, it is much more faster to do in the wild card as opposed to typing what
I want.
So let's use the asterisk.
What I just want to list every file name that starts with ABC.
You do ABC Pasterick and you will have all the files.
This starts with ABC.
I want to remove every file that starts with ABC.
You can remove one by one, ABCDE one and so on and so forth.
Again, very cumbersome.
Don't do it.
Your system administrator.
You are smart folks.
You don't want to use the commands one by one.
What you would use, you'll use a wildcard.
So you'll do A, B, C, D or a B and do Asterix.
The reason I picked the four letters, because if I just pick a and hit asterisked, it will also remove
any of the files in my home directory that starts with a and which I don't want to do it right now.
I don't have any files.
So let's say if I create a touch a so now I have all the files and a so I just want to confirm I don't
have a so I don't delete any file accidentally.
So yes, I don't have any file that begins with a other than these.
So if I just do remove a asterisk it will remove all the files that starts with hey let's check it,
see all those files are gone.
Isn't that cool.
Yes, it is.
I love this asteroid because I use it all the time.
I'm going to recreate those files again by heading up Baraki.
That will return my last round command.
Just confirm they are there now.
What if I wanted to remove everything that ends with X, Y, Z, same way removed but this time to put
an asterisk in front of x, y, z hit enter boom all gone.
Awesome.
I'm going to recreate it just for the exercise of this lesson.
It created nine files now will move on to the next wild card, which is the questionmark.
The next questionmark is telling it.
Now let's mysel questionmark b, c, d, pasterick.
OK, what am I asking here.
I'm asking is gave me all the files that has whatever the character is the first, as long as the other
characters has B, C, D and whatever comes afterwards.
These are the matching files because whatever the first character is, whether it's a or not, I don't
care.
I just want to make sure I will get the listing of the files that has B, C, D in it after the eight.
So that's how you use the question mark.
And the last one we have brackets bracket is going to tell me that give me anything that has C or D
letter in a file.
It's just that simple.
Either C, either D, either F or this and that.
So you put all that stuff that you're looking for inside of the bracket and you will have all those
files you see here.
And it went so fast, I'm going to put it in more output.
I want to see one page at a time and you'll see it gave me and it has A it has B every file that I'm
getting has either has A or B, either has A or B, so that's how it works.
That's how the wild card works again.
Now I want to get rid of all the files that has Y, X and Y in it.
Awesome.
I have my wild card.
I'm not going to go and leave one by one.
So this command is telling the shell that go ahead and please delete all the files that has X and Y
in it and X and Y.
It has to be together, of course.
So we do have these matching files, X, Y and it will go ahead and delete it and all of them are gone.
So wild card not necessarily is used, just Fideles or more.
You could use it that any of the commands you we have, you could use it with all the commands we have
learned so far.
Try it, try it with different commands.
If it doesn't work, that's OK.
Go online, Google it and try wildcard wildheart examples.
Try them.
Just get.
Familiar with them, this will help you a lot in your job, I promise you.