Afrikaans
Akan
Albanian
Amharic
Arabic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
French
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Hungarian
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranî)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Persian
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
1
In this section we're going to be talking about wild cards and this is where things start to get really
2
interesting and fun with Linux.
3
This is where you can start to see why Linux is really powerful.
4
And this section we're going to be covering what wild cards are.
5
Get a good understanding of what the concept is and see some practical examples.
6
Wild Cards also known as globbing or characters or strings used for pattern matching.
7
Usually we use those with command line to increase the flexibility of searches or commands that we are
8
issuing.
9
So what does it mean when I say the characters or strings.
10
Here are some examples.
11
The first is the asterisk character and it's used to match zero or all characters.
12
The second is the question mark is used to match exactly one character.
13
The third is a bracket and it's used to match any of the characters enclosed in the bracket.
14
And the last is the escape character and it's used to escape the above characters so if for example
15
in my search term I am looking for a bracket.
16
I will precede that with a backslash.
17
Let's see some practical examples.
18
I've created a number of files that were very commonly see when we're doing ethical hacking engagements.
19
Feel free to download these files or you can create them yourself.
20
These files are empty.
21
They're just created for the purpose of this exercise.
22
What we're looking at here is a number of files that correspond to different network ranges and network
23
addresses.
24
So the assumption is that I've been doing unethical hack for a company and I generated through our my
25
assessment and number of files from and map and a number of text files that I've written notes into
26
as you can see we have different names and different extensions to these files.
27
So we have files Dotti XTi we have files and map we have files thought and map and we're going to see
28
what the difference between these two files are later on.
29
And I have files that and would not auditee.
30
The first thing I want to do is I want to back up all these files before I start removing or moving
31
the files around just in.
32
And I can do that using the command that we saw in the previous exercise.
33
So I'm just going to type tie C F to create a file the name of the file will be back up to space star.
34
This is the first wildcard I'm using started as we've seen before means match zero or all characters.
35
So in this case I'm telling Todd to create a tar file and include and everything in the current directory.
36
Once that's done let me verify very quickly the content and I can do that using the time T.F. command.
37
And here we go.
38
I get all the files backed up.
39
Fantastic.
40
So now I can start cleaning up my directory and reorganizing it.
41
I'm going to create a directory called Notes and I want to move all the notes files into that directory.
42
It's good practice before I delete or I move any file especially before I delete any files to do.
43
And I'll ask command if I'm using any wildcards and I do that just to make sure that my command works
44
correctly and I'm not accidently deleting far as I shouldn't be deleting.
45
So now if I do not know there's that not only the notes files are listed but also the notes directory
46
that I just created a fine I'll use the asterisk wildcard and I try to move notes asterisk into the
47
notes directory.
48
The command will attempt to move everything that starts with the word notes followed with whatever.
49
So now it's 10 or 11 including the notes directory.
50
And what that means is that I'll be attempting to move the notes directory into itself.
51
This will generate an error for me.
52
But if you look a little bit closer you'll see that all the notes files have a hyphen in the middle
53
before the digit so it's notes dashed then notes that 11 or hyphen 11 notes hyphen 12 and so on.
54
So let me see what happens if I do.
55
As nodes HIF and star.
56
Excellent.
57
So this command lists all the notes Faas excluding the notes directory's.
58
Now I can safely use my move command knowing that I'm only going to be moving the files into the directory
59
without trying to move the notes directory into itself and I can do that typing move or M.V. notes dash
60
start for all the notes file.
61
So this is going to go with notes.
62
Then the XTi and nod's 24 dot auditee so it doesn't matter what the digit is it doesn't matter what
63
the extension is.
64
And it doesn't matter what follows the notes hyphen and I hit enter.
65
And I do an S on the notes directory.
66
And here we go.
67
I managed to successfully move all my notes into the notes directory.
68
Excellent.
69
Let me clear the screen and I do as again here's what I want to do.
70
Now I want to get rid of all the ten ten hundred files.
71
Here's a scenario I did a scan on this network and no results were found.
72
So I don't need to be keeping these files I just want to remove them.
73
The challenging bit here though is that I have turned up 10 to 100 thought zero Dot T XTi.
74
And then I have the tender turned up 100 without the zero g and map and the third one is dot and map.
75
So what's the simplest way to remove these three files.
76
Again I'm going to verify my command with L as before I'd move anything.
77
Let me try and do s 10 dot dot 100 dot all that was simple enough so that listed the three files for
78
me.
79
So now for that to work with the remove commands I need to add the asterisk to tell the command to look
80
for anything after the 100 dot.
81
I can verify this with a standard 10 to 100 dot asterisk.
82
And again that listed out the three fives.
83
Perfect.
84
Now all I need to do is replace the L S with.
85
I am great I'll clear the screen again an L S.
86
Now here's what I want to do.
87
I want to move all the files into one that actually remember.
88
I have two different extensions G and map and map.
89
We'll see how we're going to manage that.
90
First I want to create a directory called and map once that's done I'm going to try and list all the
91
and map files.
92
I'm going to try as asterisk Daut and map
93
that didn't actually work so that listed all the flaws that start with anything with the extension dot
94
and map what that missed out on the G and map.
95
Whatever if I do I'll start a dot G and map
96
that unfortunately it doesn't work either.
97
So it only lists the files with the G and map extension.
98
That's my challenge.
99
Now I want a command that lists both.
100
So the command should say list whatever dot and map and Dot G and map how can I do that.
101
What if I put another asterisk after the dot so l as asterisk dot asterisk and map.
102
Excellent.
103
This worked.
104
So what this commanded is that it listed anything dot anything.
105
Followed immediately with map.
106
So for example I had a file with extension thought.
107
1 2 3 4 5 6 and map that would have been listed as well.
108
So now that my command works all I need to do again is replace the L S with M.V.
109
and I do s on the end map directory and he would go on my and my files are in one directory and clear
110
the screen.
111
Now things will start to get a little bit more interesting.
112
I have different network ranges I have that 10 ten top 10 10 that turned up 11 and 10 out 10 12 I'm
113
going to call that the 10s range because it's 10 11 12.
114
I also have the 20s range so tender Tandou 23 24 and 25.
115
I'm going to call those the 20s range and last.
116
I have the tender Tom two hundred range two or six or seven and two or eight while I want to do now
117
is move all these different ranges into different folders.
118
So I'm going to start by creating the different directories I'll create the tens twenties and to hundreds.
119
Now let me try the first command.
120
I'm going to do it as 10.0 and not one that was easy enough.
121
That lasted for me.
122
The 10s range than the 10 the 10 11 12.
123
So now if I do understand that one asterisk it should produce the same result.
124
There we go.
125
And all I need to do now is move.
126
Change the L S to move and add the directory name I list the contents of the directory and all the files
127
are moved.
128
Now what happens if I try the same thing with the 20s.
129
Let's see.
130
I'll ask them then that tended to.
131
Oh that doesn't look like it's going to work.
132
At least the 20s and the two 100s because they both start with two.
133
So if I do understand the to star I'm going to get both ranges.
134
So what do I do now.
135
Remember the question Mike.
136
So the asterisk matched zero or all characters.
137
The question mark matches exactly one character.
138
So now if I put the question mark after the two and I add the extension dot whatever.
139
I'll only get a listing of the 20s.
140
Why.
141
Because the question mark replaces only one digit after the two.
142
In this case 23 24 and 25.
143
What if I wanted to list the hundreds.
144
Simple.
145
I put another question like.
146
So now I'm telling as to list 10 to attend attended two digit digit dot whatever.
147
Great.
148
Here we go.
149
Now all I need to do is change the l s and to move.
150
I move the 20s in to one directory
151
and I do as again now all that's left are the two hundreds Obviously I could repeat the old commands
152
and I can do two question marks but that's not the fastest way to do that.
153
If you look at the contents of the file all that's left are the text files and they all start with some
154
digits.
155
Dorothy XTi now because all that's left are the two 100s.
156
I know that I want to move all of these into the 200 folder.
157
So the simplest process way to do that is replace the network ranges with a star or asterisk.
158
Telling my move command to move everything that ends with a dot the XTi and I put the folder name and
159
done I do as a double check.
160
Good stuff.
161
Here's a quick bonus for you.
162
I'm going to try the three commands.
163
It doesn't exist.
164
So we're going to use what we just learned in the previous sections to install the command AAPT get
165
install three wait for a few seconds for it to install.
166
Now if I try again the command exists.
167
So the three command shows you the content of any directory and a more graphical organized format.
168
I want to see the content of the current directory that I'm in.
169
What do I do.
170
We've seen this before.
171
Three space dot.
172
And it shows me this neat organized output.
173
I can verify that understands I have the tens range on there to hundreds.
174
Same twenty's same unmap has all the and mapped files and all the data XTi nodes and not all the nodes
175
are in my notes directory.
176
Now that looks much more organized than it looked before hazier mission for the section.
177
If you haven't been following up with what I've done please do it.
178
Practice it.
179
It might sound like it's a lot of information but with practice it will get easier and easier and you'll
180
notice that almost 90 percent of the time your usage will be limited to asterisk.
181
So practice a little bit with that.
182
Create these files.
183
Repeat the exercises if you haven't done so already following up with the video so we can move into
184
the next section.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.