1 00:00:00,660 --> 00:00:03,450 ‫Now grep, this is a command. 2 00:00:03,930 --> 00:00:12,660 ‫Well, I'll tell you that grep stands for globally, search for a regular expression and then print 3 00:00:12,660 --> 00:00:13,050 ‫it out. 4 00:00:13,990 --> 00:00:15,090 ‫So that's why we say grip. 5 00:00:15,780 --> 00:00:21,430 ‫But the grab command basically searches a file for a particular pattern of characters. 6 00:00:22,020 --> 00:00:25,140 ‫And then it'll display of lines that contain that pattern. 7 00:00:26,580 --> 00:00:29,640 ‫The tech search pattern is called a regular expression. 8 00:00:30,120 --> 00:00:33,540 ‫So when it finds a match, it prints the line with a result. 9 00:00:34,380 --> 00:00:39,660 ‫The grep command is handy when searching through very large log files, for instance. 10 00:00:41,200 --> 00:00:46,360 ‫The Dash I parameters used to perform case insensitive searches. 11 00:00:47,670 --> 00:00:51,090 ‫You can use regular expressions with Dash E parameters. 12 00:00:51,990 --> 00:00:56,490 ‫Dash, our parameters can be used to read all files under each directory. 13 00:00:56,820 --> 00:00:58,050 ‫Recursively. 14 00:01:00,040 --> 00:01:06,640 ‫And then finally, the Dash V parameter, we use that when we want to select none matching lines. 15 00:01:08,350 --> 00:01:10,330 ‫All right, so let's give it a shot. 16 00:01:10,720 --> 00:01:11,680 ‫Let's go to Carly. 17 00:01:12,910 --> 00:01:17,440 ‫Let's read the content of the slash Etsy password file. 18 00:01:18,610 --> 00:01:23,440 ‫So this is a plain text file that contains a list of this system's account. 19 00:01:24,440 --> 00:01:30,680 ‫Giving for each account some useful information like User ID, Group, I.D., Home Directory, Shell 20 00:01:30,680 --> 00:01:33,200 ‫and so much more. 21 00:01:35,280 --> 00:01:43,730 ‫Of course, we could search for a particular pattern in this file, so let's run grep Cowley slash ETSI 22 00:01:43,730 --> 00:01:46,730 ‫slash police S.W.2d. 23 00:01:50,100 --> 00:01:52,980 ‫And here, as you can see, it, filtered the result containing Kelly. 24 00:01:55,010 --> 00:01:58,940 ‫So why don't we use a regular expression with the Dash E parameter? 25 00:02:01,000 --> 00:02:07,720 ‫So Linux regular expressions are special characters which help search data and matching complex patterns. 26 00:02:09,450 --> 00:02:15,120 ‫So if we had the carrot symbol to the beginning of a word, it'll display the pattern to start with 27 00:02:15,120 --> 00:02:15,570 ‫Callie. 28 00:02:19,930 --> 00:02:24,970 ‫Now, to do a case insensitive search, we can always add the Dash II parameter. 29 00:02:26,080 --> 00:02:30,520 ‫And will capitalize the first letter of Kelly so that we can see the result. 30 00:02:36,910 --> 00:02:39,050 ‫Now, as you can see, the result did not change. 31 00:02:39,090 --> 00:02:44,620 ‫It shows the patterns that start with Carly, regardless of upper or lower case. 32 00:02:47,280 --> 00:02:50,130 ‫All right, so now let's perform a recursive search. 33 00:02:51,520 --> 00:02:57,730 ‫So we can search for open VPN under these last user folder recursively. 34 00:02:59,140 --> 00:03:01,510 ‫We can also see the full path of the matched pattern. 35 00:03:17,330 --> 00:03:22,640 ‫Now, if you want to select non matching mines, you can just use the Dash V parameter. 36 00:03:23,750 --> 00:03:27,470 ‫And it shows the patterns that do not start with Kelly.