1
00:00:01,360 --> 00:00:08,620
As you have seen in previous examples, by default, the LHS command lists all the Non-hidden directory

2
00:00:08,620 --> 00:00:08,980
files.

3
00:00:08,980 --> 00:00:15,130
So sometimes this can be overkill, especially when you're just looking for information on a few files.

4
00:00:15,130 --> 00:00:22,210
So fortunately, the LHS command also provides a way for you to define a filter on the command line.

5
00:00:22,210 --> 00:00:29,140
So it uses the filter to determine which files or directories it should display in the output.

6
00:00:29,140 --> 00:00:36,700
So before using the filter command here, let's create some files to play with the via touch command

7
00:00:36,700 --> 00:00:36,940
here.

8
00:00:36,940 --> 00:00:40,720
So which you will learn touch command in more detail in next lecture.

9
00:00:40,720 --> 00:00:43,180
So let's actually by creating touch here.

10
00:00:43,180 --> 00:00:46,450
So let's create our file names.

11
00:00:46,450 --> 00:00:48,730
So my file.

12
00:00:50,810 --> 00:00:54,080
Uh, Oxley Academy.

13
00:00:56,150 --> 00:00:58,790
My document.

14
00:01:00,850 --> 00:01:02,710
Just a picture.

15
00:01:03,490 --> 00:01:04,570
And yeah, that's.

16
00:01:04,570 --> 00:01:07,090
I think that's okay enough.

17
00:01:07,360 --> 00:01:07,870
Yeah.

18
00:01:07,870 --> 00:01:13,960
And here and as you can see here, just the picture, my document, my file and Excel Academy is created

19
00:01:13,960 --> 00:01:14,440
here.

20
00:01:14,440 --> 00:01:17,500
So now let's actually create another.

21
00:01:19,080 --> 00:01:21,160
And another file, too.

22
00:01:21,180 --> 00:01:22,430
So torch.

23
00:01:25,800 --> 00:01:27,810
And in order to do that.

24
00:01:27,810 --> 00:01:34,470
So let's actually create the fall fell fill and full here.

25
00:01:34,560 --> 00:01:38,370
We also created this and fall fill, fill and full.

26
00:01:38,610 --> 00:01:44,010
So the filter command works as simple text matching strings.

27
00:01:44,010 --> 00:01:51,090
So include the filter after any command line parameters you want to use like this for here, for example,

28
00:01:51,090 --> 00:01:53,460
in this case we're going to use the long here.

29
00:01:53,460 --> 00:01:57,930
So now we're going to create, for example, my file here, right?

30
00:01:57,930 --> 00:01:59,640
My file.

31
00:02:00,780 --> 00:02:08,820
And as you can see here, we specified the name of the specific file as the filter.

32
00:02:08,820 --> 00:02:12,990
So the command only shows this file information.

33
00:02:12,990 --> 00:02:17,550
Sometimes you might not know the exact file name you're looking for.

34
00:02:17,550 --> 00:02:24,420
And the LS command also recognized standard wildcard characters and uses them to match patterns with

35
00:02:24,420 --> 00:02:25,080
the filter.

36
00:02:25,080 --> 00:02:25,690
So.

37
00:02:25,690 --> 00:02:29,650
So a question mark here represents one character.

38
00:02:29,650 --> 00:02:33,610
So ls a question mark represents one character here.

39
00:02:33,610 --> 00:02:35,440
So you can do like this.

40
00:02:36,070 --> 00:02:37,960
Let's actually create.

41
00:02:38,860 --> 00:02:43,420
So here, let's actually open our marker.

42
00:02:43,450 --> 00:02:44,350
Oops, Sorry.

43
00:02:45,650 --> 00:02:46,300
Yeah.

44
00:02:46,310 --> 00:02:49,930
Let's open our marker here.

45
00:02:49,940 --> 00:02:50,950
Yeah, Gromit.

46
00:02:50,960 --> 00:02:55,130
And now I want to write something on here.

47
00:02:55,130 --> 00:02:59,960
So firstly, as we created our files, we have file.

48
00:03:00,090 --> 00:03:00,620
File.

49
00:03:00,620 --> 00:03:01,880
Firstly, file.

50
00:03:02,740 --> 00:03:04,570
So then we have fell.

51
00:03:06,680 --> 00:03:08,900
And then we have Phil.

52
00:03:11,570 --> 00:03:14,660
And also lastly, we have full here.

53
00:03:16,180 --> 00:03:24,700
So let's actually what these characters and the sentences has common is that they always start with

54
00:03:24,700 --> 00:03:27,450
F and the last character.

55
00:03:27,460 --> 00:03:30,220
Last character is always l l here.

56
00:03:30,220 --> 00:03:35,530
So in this case, if we want to filter this, we can also do this.

57
00:03:35,530 --> 00:03:38,320
For example, let's yes here.

58
00:03:38,320 --> 00:03:41,080
So let's create a new file.

59
00:03:41,080 --> 00:03:43,360
In order to do that, we're going to do.

60
00:03:44,660 --> 00:03:45,140
Yeah.

61
00:03:45,350 --> 00:03:46,760
LZ, L here.

62
00:03:46,850 --> 00:03:47,190
Oops.

63
00:03:47,570 --> 00:03:49,710
LZ LSL.

64
00:03:49,730 --> 00:03:54,560
And as you can see here, we have file fill, full fill and other documents here.

65
00:03:54,560 --> 00:04:02,180
So if you want to just print those files, we need to do LZ here, Clear LSL.

66
00:04:02,180 --> 00:04:07,850
So we're going to we're going to do here ls l f question mark.

67
00:04:08,650 --> 00:04:11,170
And fill or LL here.

68
00:04:11,170 --> 00:04:14,620
And as you can see, here we are.

69
00:04:14,620 --> 00:04:19,240
This question mark, as I said earlier, is represents one character.

70
00:04:19,240 --> 00:04:21,400
So this question mark represents one character.

71
00:04:21,490 --> 00:04:22,330
We don't know.

72
00:04:22,330 --> 00:04:25,720
But we want to search these terms here, as you can see here.

73
00:04:25,720 --> 00:04:29,530
So here we added the question mark here.

74
00:04:29,530 --> 00:04:40,510
So we added here f question mark and LL So this tells us that start with start for characters that start

75
00:04:40,510 --> 00:04:46,240
with the F and end with the last two characters has two L's on it.

76
00:04:46,240 --> 00:04:49,240
So we just want to filter this here.

77
00:04:49,360 --> 00:04:53,920
So we also have the asterisks to represent any number of characters.

78
00:04:54,640 --> 00:04:59,830
But here, for example, we can also do let's actually delete this.

79
00:04:59,830 --> 00:05:01,210
Yeah, we can also.

80
00:05:01,210 --> 00:05:09,430
So here we had the my file, my document, just the picture and let's create another here touch ox and

81
00:05:09,430 --> 00:05:10,960
my Oxley.

82
00:05:12,200 --> 00:05:13,010
Pouch.

83
00:05:14,350 --> 00:05:18,620
Touch my Linux and LZ here.

84
00:05:18,630 --> 00:05:19,350
Clear.

85
00:05:19,380 --> 00:05:24,300
Firstly, LZ, and as you can see here, my document, my file, my Linux, my Excel.

86
00:05:25,020 --> 00:05:28,350
So in order to do that, we're going to do here.

87
00:05:28,920 --> 00:05:30,500
LZ Oops.

88
00:05:30,510 --> 00:05:32,690
Yeah, LZ, L here.

89
00:05:32,700 --> 00:05:35,100
So we're going to do so, as you know, here.

90
00:05:35,100 --> 00:05:38,460
So we have the my.

91
00:05:39,760 --> 00:05:41,200
My document.

92
00:05:45,780 --> 00:05:48,840
Also we have here my file.

93
00:05:54,590 --> 00:05:56,810
Also we have my Linux.

94
00:06:01,950 --> 00:06:03,750
Also lastly my Oxley.

95
00:06:10,060 --> 00:06:10,720
Here.

96
00:06:10,720 --> 00:06:17,500
So now in order to search these files, as you can see here with the LSL command, we got like a wide

97
00:06:17,740 --> 00:06:18,790
range of files.

98
00:06:18,790 --> 00:06:24,310
But if we want to filter these files and the filter, that's.

99
00:06:25,200 --> 00:06:29,840
Filter names that start with the my here m I or other characters.

100
00:06:29,850 --> 00:06:31,530
We're going to do just this here.

101
00:06:31,530 --> 00:06:40,350
So let's get here and we will do my and this asterisk and here it will show us files that start with

102
00:06:40,350 --> 00:06:47,730
my so we can also do that with this here so lsl f and asterisk instead of here.

103
00:06:47,730 --> 00:06:50,640
And as you can see here, we got the same result.

104
00:06:51,510 --> 00:06:53,770
But actually, these are not the same.

105
00:06:53,790 --> 00:07:03,540
Of course, if, for example, let's create another file, touch file fail, and here we will enter

106
00:07:03,540 --> 00:07:04,950
our old command.

107
00:07:04,950 --> 00:07:06,150
So clear.

108
00:07:06,300 --> 00:07:07,230
Clear.

109
00:07:08,040 --> 00:07:12,030
LSL And as you can see, we have failed fall field.

110
00:07:13,640 --> 00:07:15,020
Fill and full.

111
00:07:15,020 --> 00:07:16,550
And here we're going to do.

112
00:07:18,420 --> 00:07:26,400
Yeah, we will do the previous comment here F and here WL here and as you can see we don't we don't

113
00:07:26,400 --> 00:07:32,250
see our fail here because fail last two characters is not WL here.

114
00:07:32,250 --> 00:07:34,890
So that's it with our example here.

115
00:07:34,980 --> 00:07:41,280
In next lecture I will the talk about the handling and creating files in Linux.

116
00:07:41,280 --> 00:07:42,390
So see you later.
