1 00:00:00,630 --> 00:00:08,010 Hello everyone in this with you we are going to continue our discussion on the Linux wildcards. 2 00:00:08,160 --> 00:00:16,260 So in the last with you we talked about the asterisk which is a wild card that matches or represents 3 00:00:16,350 --> 00:00:24,660 any characters and we also mention the question mark which is a wild card that represents or matches 4 00:00:24,660 --> 00:00:26,550 any single character. 5 00:00:26,940 --> 00:00:33,180 And we we now know the difference between the asterisk and the question mark. 6 00:00:33,410 --> 00:00:39,030 So let's continue and deepen our knowledge about the Linux wildcards. 7 00:00:39,060 --> 00:00:45,330 So right now I have as you can see many files on my desktop and I have directly one which is initially 8 00:00:45,330 --> 00:00:46,940 empty. 9 00:00:47,010 --> 00:00:54,420 So let's see that you're interested in a range of characters so you can specify a range by using square 10 00:00:54,420 --> 00:00:55,040 brackets. 11 00:00:55,050 --> 00:00:59,360 And here you put the range of the characters so what do I mean by this. 12 00:00:59,370 --> 00:01:08,150 Imagine that if you want to copy all the files that begins with the lower case letters a b or c.. 13 00:01:08,250 --> 00:01:16,240 So if you want this you can say C-p and then use square brackets here and then here is better for your 14 00:01:16,240 --> 00:01:21,320 characters ABC and then followed by anything directly one. 15 00:01:21,340 --> 00:01:28,300 So what I'm saying here is that copy all the files that begins with the lower case letters A B or C 16 00:01:28,540 --> 00:01:29,580 followed by anything. 17 00:01:29,590 --> 00:01:32,010 I don't care about anything I just care about. 18 00:01:32,020 --> 00:01:36,180 All I care about is that it begins with the lower case letters A B or C. 19 00:01:36,250 --> 00:01:42,100 So if you to if you if you look here if you look here you would see that apples bananas and carrots 20 00:01:42,100 --> 00:01:45,620 will be the only guys that qualify for this command. 21 00:01:45,670 --> 00:01:52,610 And if I execute this command here and I go to my directory one you'd see apples bananas and carrots. 22 00:01:52,630 --> 00:01:53,170 Awesome. 23 00:01:53,200 --> 00:01:55,470 I'll I'll delete them now. 24 00:01:56,500 --> 00:02:03,750 So here it using the square brackets you can specify a range of characters. 25 00:02:04,600 --> 00:02:11,380 So what if you want to do the complement of this command if you want to execute the opposite of this 26 00:02:11,380 --> 00:02:11,740 command. 27 00:02:11,740 --> 00:02:13,210 So what do I mean by this. 28 00:02:13,600 --> 00:02:18,980 What if you say C-p exclamation mark. 29 00:02:21,260 --> 00:02:25,070 ABC star directly what. 30 00:02:25,150 --> 00:02:32,370 So when you put an exclamation mark here that means that I will do the complement of this command. 31 00:02:32,380 --> 00:02:34,210 Or the opposite of this command. 32 00:02:34,210 --> 00:02:41,620 So what I'm saying is that copy all the files that does not begin with the lower with the lower case 33 00:02:41,620 --> 00:02:44,580 letters A B or C. 34 00:02:44,800 --> 00:02:53,900 So if I figure this command would you would see that it includes all the files but it did not include 35 00:02:54,110 --> 00:03:03,290 apples bananas or carrots because here I said they exclude the exclamation mark here means that it does 36 00:03:03,290 --> 00:03:04,400 not include. 37 00:03:04,640 --> 00:03:09,200 So this command is actually is actually the complement of this command. 38 00:03:09,380 --> 00:03:14,510 So if you know if you know mathematics or computer science you would know what I mean by complement 39 00:03:14,540 --> 00:03:17,420 just like unions and sets and etc. right. 40 00:03:18,800 --> 00:03:24,170 Because like this command plus just command covers all the files. 41 00:03:24,180 --> 00:03:26,100 This is why I say the complement. 42 00:03:26,120 --> 00:03:27,070 OK. 43 00:03:29,120 --> 00:03:37,850 So when you say exactly exclamation mark range it means all the character that is not in this range. 44 00:03:37,850 --> 00:03:38,490 OK. 45 00:03:38,830 --> 00:03:44,710 So let's do another example let's say for example let's delete everything here first. 46 00:03:44,960 --> 00:03:46,240 OK leader. 47 00:03:46,670 --> 00:03:53,380 So let's say that you want to include all the files that begins with a number. 48 00:03:53,600 --> 00:03:59,440 So for example 1G will go here this guy this again this guy and this guy and that guy. 49 00:03:59,950 --> 00:04:00,500 OK. 50 00:04:00,650 --> 00:04:05,420 So I want to include all these files here that begins with numbers. 51 00:04:05,420 --> 00:04:16,990 So I would say C-p square brackets 0 to 9 and I don't care about anything else. 52 00:04:16,980 --> 00:04:18,410 Directory 1. 53 00:04:18,900 --> 00:04:24,780 And if I go here I would I would see all the guys that I talked to about any file that begins with a 54 00:04:24,780 --> 00:04:34,450 number with covered so simply I can see C.P or like a number additional and then does. 55 00:04:36,420 --> 00:04:38,000 Is a range right. 56 00:04:38,010 --> 00:04:44,250 So when I say 0 Dash 9 it means all the numbers from 0 to 9. 57 00:04:44,280 --> 00:04:56,000 However for example let's say that I have a file here called which is for example I'll call it a K and 58 00:04:56,830 --> 00:04:58,330 delete everything here. 59 00:05:00,840 --> 00:05:05,570 And let's say that for example I want to copy all the files from zero. 60 00:05:05,830 --> 00:05:10,980 It begins with the number zero to 7 directly one 61 00:05:14,470 --> 00:05:21,010 so of course if I go to the rectory one here I will not see eight because I did not include eight in 62 00:05:21,010 --> 00:05:21,660 my range. 63 00:05:21,660 --> 00:05:23,740 However if I put eight here 64 00:05:26,830 --> 00:05:28,880 it will be included as you can see. 65 00:05:29,290 --> 00:05:30,130 OK. 66 00:05:30,130 --> 00:05:35,330 So that's how we can include numbers and you can specify a range of numbers. 67 00:05:35,560 --> 00:05:37,760 OK let's leave this guy as well. 68 00:05:39,970 --> 00:05:49,500 And let's move forward so you can also specify a class or category of characters. 69 00:05:49,510 --> 00:05:56,710 So what do I mean by this let's say for example that so right now my directly with at empty right let's 70 00:05:56,710 --> 00:06:02,330 say that you want to copy all the files and begins with an upper case letter. 71 00:06:02,800 --> 00:06:08,930 So you could say colon or two square brackets. 72 00:06:13,340 --> 00:06:20,050 Then you close the square brackets and I don't care what the end was. 73 00:06:20,060 --> 00:06:27,030 All I care to hear about is the beginning of the character ok and copy the directory one. 74 00:06:27,180 --> 00:06:34,150 So what I'm saying here is that copy all the files that begins with an uppercase letter. 75 00:06:34,240 --> 00:06:44,820 OK so here it will cover Paris Rome London and Linux and that's it. 76 00:06:44,820 --> 00:06:49,390 So it will cover Rome Linux London and Paris. 77 00:06:49,410 --> 00:06:56,690 So if I could just command and open my directory one I should see Linux London Paris and Rome. 78 00:06:56,740 --> 00:07:00,420 So all these guys here begins was an upper case letters. 79 00:07:00,430 --> 00:07:01,990 So this is how you can do it. 80 00:07:02,350 --> 00:07:11,220 And if I delete all these guys here and I said copy all the guys with lower case letters begins with 81 00:07:11,220 --> 00:07:12,460 a lower case letters. 82 00:07:12,760 --> 00:07:14,540 So this is very easy as well. 83 00:07:15,500 --> 00:07:21,350 So if I open my directly one now I would see all the files that begins with a lower case letter. 84 00:07:21,350 --> 00:07:26,030 Of course the number is here like any file beginning with a number it's not included because the number 85 00:07:26,300 --> 00:07:32,600 is not considered to be a lowercase letter and the London Linux Paris and Rome are also not included 86 00:07:32,600 --> 00:07:35,150 because they are not an opera. 87 00:07:35,160 --> 00:07:37,660 It did not begin with an uppercase letters. 88 00:07:38,170 --> 00:07:38,730 OK. 89 00:07:38,780 --> 00:07:40,460 There are there there is also. 90 00:07:40,540 --> 00:07:47,630 To be useful to other useful classes or categories of characters which is the desert. 91 00:07:47,630 --> 00:07:53,120 So for example you can say copy Folles everything here first. 92 00:07:57,520 --> 00:08:01,870 Let's say for example that you want to copy 93 00:08:05,850 --> 00:08:07,520 all the files that begin with. 94 00:08:07,630 --> 00:08:12,970 And actually all the files that end with a digit not begins. 95 00:08:13,060 --> 00:08:14,030 I would say it 96 00:08:18,700 --> 00:08:19,890 directory one. 97 00:08:20,050 --> 00:08:25,570 So here it will copy all the files that ends with a lizard or a number. 98 00:08:25,570 --> 00:08:27,300 So can you see any of the files. 99 00:08:27,370 --> 00:08:31,710 I can see everyone actually I can see this guy 1G one. 100 00:08:31,960 --> 00:08:37,410 And this guy also and 1 2 3 1 and 3 and these two guys here. 101 00:08:38,200 --> 00:08:43,180 And also these guys so it will not include for example 1G. 102 00:08:43,480 --> 00:08:45,640 It will not include 2G and 3G. 103 00:08:45,860 --> 00:08:46,370 OK. 104 00:08:48,110 --> 00:08:56,480 Let's go to the rectory one and right now we can see all the files that ends with a number or ends with 105 00:08:56,480 --> 00:09:04,290 a digit as you can see so that digit is also a very famous category of class or like category of characters 106 00:09:04,310 --> 00:09:05,560 right. 107 00:09:06,500 --> 00:09:11,870 OK there are two more categories of classes which is the alphanumeric and the alpha 108 00:09:15,170 --> 00:09:29,540 so if you said here copy all the files that begins with an alphabetic character and alphabetical like 109 00:09:29,540 --> 00:09:35,170 with any any file that begins with an alphabet try and copy it to directly one. 110 00:09:35,480 --> 00:09:39,600 So this will not include anything that begins with a number. 111 00:09:39,620 --> 00:09:40,250 OK. 112 00:09:41,820 --> 00:09:45,370 So let's see yeah. 113 00:09:45,430 --> 00:09:48,390 It does not include anything that begins with a number. 114 00:09:48,400 --> 00:09:59,170 However if you want to include numbers as well you can say l and you and so this will be alphanumeric. 115 00:09:59,170 --> 00:10:02,110 If you go there you can see all our files. 116 00:10:02,110 --> 00:10:06,260 Now so there are five categories. 117 00:10:06,720 --> 00:10:07,650 There is. 118 00:10:07,950 --> 00:10:08,400 Is it 119 00:10:13,400 --> 00:10:14,120 also 120 00:10:20,010 --> 00:10:21,810 which is alphabets. 121 00:10:23,430 --> 00:10:28,050 There is. 122 00:10:28,600 --> 00:10:34,610 There is also alphanumeric which includes both alphabets and digits. 123 00:10:34,640 --> 00:10:37,170 There is also lower case letters 124 00:10:41,640 --> 00:10:44,420 and there is also an upper case letters. 125 00:10:44,470 --> 00:10:49,640 So in total we have five classes desert Alpha alphabets. 126 00:10:49,830 --> 00:10:52,950 Alphanumerics lower and upper. 127 00:10:53,310 --> 00:10:56,010 And these guys are very very useful as you can see. 128 00:10:56,340 --> 00:10:59,430 So let's do two more examples. 129 00:11:01,080 --> 00:11:05,520 Let's say for example that you want to copy. 130 00:11:05,630 --> 00:11:09,270 Let's make sure that I would direct you one of the empty first. 131 00:11:09,550 --> 00:11:18,670 So right now I want to copy all my files that begins with each digit. 132 00:11:19,120 --> 00:11:23,120 So you have to put two square brackets digit. 133 00:11:24,250 --> 00:11:26,670 And ends with each with 134 00:11:29,980 --> 00:11:31,450 with an with an alphabet 135 00:11:34,890 --> 00:11:43,670 OK and copy it to directly one for here I include all I copy all the files that begin with a visit and 136 00:11:43,760 --> 00:11:45,460 ends with an alphabet. 137 00:11:46,550 --> 00:11:53,560 So something like something like 1G and 2G and 3G. 138 00:11:54,810 --> 00:11:57,660 And and that's it. 139 00:11:57,710 --> 00:11:58,490 So it will. 140 00:11:58,540 --> 00:12:03,460 It should include 1G one 2G and 3G. 141 00:12:03,570 --> 00:12:07,760 These are only the guy that will that should be included. 142 00:12:07,760 --> 00:12:16,920 As you can see so combining classes or categories of characters is very useful as you can see and you 143 00:12:16,920 --> 00:12:20,010 can actually do the negation. 144 00:12:20,250 --> 00:12:22,350 So you can say C-p 145 00:12:33,450 --> 00:12:39,690 So here I'm saying copy of the file that does not begin with does it because you have an exclamation 146 00:12:39,690 --> 00:12:46,860 mark. 147 00:12:47,250 --> 00:12:47,970 No. 148 00:12:48,210 --> 00:12:48,450 Yeah. 149 00:12:48,450 --> 00:12:50,410 Here I have those guys from the old. 150 00:12:50,580 --> 00:12:56,180 So if I delete this let's see if it leads and I execute this command again. 151 00:12:56,520 --> 00:13:03,360 It will include all the files that does not begin with a number or added so you can use the exclamation 152 00:13:03,360 --> 00:13:03,960 mark as well. 153 00:13:03,960 --> 00:13:12,840 Here in that category the class OK let's do one more example before we end this lecture or this video. 154 00:13:13,310 --> 00:13:16,210 Let's copy. 155 00:13:16,220 --> 00:13:18,660 So let's first delete everything that I have 156 00:13:22,710 --> 00:13:23,180 OK. 157 00:13:23,210 --> 00:13:27,780 Let's say that I want to copy all the files 158 00:13:31,530 --> 00:13:33,700 that begins with an alphabet. 159 00:13:35,070 --> 00:13:37,100 Or actually with a lowercase letter 160 00:13:40,490 --> 00:13:41,580 OK. 161 00:13:46,150 --> 00:13:49,420 And ends with a different 162 00:13:55,110 --> 00:13:58,620 to directly one. 163 00:13:58,620 --> 00:14:09,270 So I think that begins with a lowercase letter for example Z and yet z 1 2 and 3 should be the only 164 00:14:09,270 --> 00:14:10,190 guy here. 165 00:14:13,060 --> 00:14:15,380 1G two and three. 166 00:14:16,180 --> 00:14:16,660 OK. 167 00:14:16,650 --> 00:14:18,120 So awesome. 168 00:14:18,340 --> 00:14:20,720 So that's all about wildcards. 169 00:14:21,010 --> 00:14:26,470 You know now about the asterisk which matches anything any character you know about this question mark 170 00:14:26,470 --> 00:14:35,910 which matches any single character you know about the Rangers you know about the complement of the Rangers 171 00:14:36,350 --> 00:14:39,660 we know about numbers how to put numbers here. 172 00:14:39,660 --> 00:14:48,150 There are nine etc. you know about classes of characters you know about digits alphanumerics numerics 173 00:14:48,780 --> 00:14:50,220 lower and upper case letters. 174 00:14:50,220 --> 00:14:59,010 So right now you basically know about everything that is related to wild cards and wild cards are very 175 00:14:59,010 --> 00:15:07,320 very useful and you would see yourself using them a lot if you continue to use your Linux command line. 176 00:15:07,320 --> 00:15:09,110 So that's it for this video. 177 00:15:09,230 --> 00:15:09,730 Ciao.