1 00:00:00,390 --> 00:00:01,230 Hello, everyone. 2 00:00:01,710 --> 00:00:06,660 In this video, I'll show you how to use the head, tail and sword commands. 3 00:00:07,050 --> 00:00:12,250 So in many cases, you might only be interested to display the first fuel line for file. 4 00:00:12,810 --> 00:00:16,350 And for that case, you can use the head command. 5 00:00:16,530 --> 00:00:23,040 For example, if I run the command head slash Etsy slash path, W.D., it will show me the first few 6 00:00:23,040 --> 00:00:24,790 lines of the file. 7 00:00:24,790 --> 00:00:26,700 Slash Etsy is less path W.D.. 8 00:00:27,000 --> 00:00:32,850 In fact, they had command displays the first 10 lines by default. 9 00:00:33,270 --> 00:00:33,710 All right. 10 00:00:35,610 --> 00:00:39,810 They had command can accept more than one file at an argument. 11 00:00:39,870 --> 00:00:43,750 For example, the fire on the command had slashed ceaseless path. 12 00:00:43,770 --> 00:00:46,440 W.D. Slash at this large group. 13 00:00:47,730 --> 00:00:51,600 It will show you the first 10 lines of both failed here. 14 00:00:52,070 --> 00:00:59,510 Okay, so you can pass multiple files at an argument to the head command and you can see the feresten 15 00:00:59,550 --> 00:01:02,910 lines of the slash at six large group file. 16 00:01:03,210 --> 00:01:07,580 And the first 10 lines of the slash etsi slash path W.D. file. 17 00:01:08,220 --> 00:01:14,340 You might be wondering what if I want to view the first three lines of her file. 18 00:01:14,820 --> 00:01:21,900 In that case, you can use the dash and option or pass the dash and option followed by the number of 19 00:01:21,900 --> 00:01:24,570 lines followed by your file. 20 00:01:25,650 --> 00:01:32,140 So here I am showing the first three lines of the file slash etsi slash path W.D.. 21 00:01:33,090 --> 00:01:37,380 And here I'm going to show the first seven lines because they're like the number seven. 22 00:01:37,830 --> 00:01:39,180 It's my lucky number. 23 00:01:41,970 --> 00:01:46,890 So here I show the first seven lines of my files last at this large group. 24 00:01:47,400 --> 00:01:47,750 OK. 25 00:01:48,390 --> 00:01:49,230 Amazing. 26 00:01:49,320 --> 00:01:52,380 Now, what about the opposite case? 27 00:01:52,650 --> 00:01:58,200 What about if you want to see or display the last few lines of a file? 28 00:01:59,070 --> 00:02:02,040 In that case, you can use the tail command. 29 00:02:02,120 --> 00:02:02,700 Makes sense. 30 00:02:03,300 --> 00:02:09,060 The opposite of head is still so tail slash at Sizzlers Pass. 31 00:02:09,060 --> 00:02:13,500 W.D. will show you the last 10 lines by default of a file. 32 00:02:14,010 --> 00:02:17,390 And in a similar fashion, you can use multiple files here. 33 00:02:19,260 --> 00:02:23,370 Let's see the different file slash Etsy slash services. 34 00:02:23,400 --> 00:02:24,210 It's a very 35 00:02:26,730 --> 00:02:27,730 nice file here. 36 00:02:27,740 --> 00:02:31,590 It shows you all the different Linux services and the port. 37 00:02:31,630 --> 00:02:33,960 No, the use and the protocol as well. 38 00:02:34,830 --> 00:02:35,000 OK. 39 00:02:35,200 --> 00:02:40,910 So here I see the last 10 lines of the file slash Etsy slash services. 40 00:02:41,340 --> 00:02:45,290 And the last 10 lines of the file slash Etsy is less path W.D.. 41 00:02:46,260 --> 00:02:50,190 And the tell command also except the dash and option. 42 00:02:52,420 --> 00:03:01,880 So let's see the last three services and let's see the last seven lines of the five slash exit slash 43 00:03:01,880 --> 00:03:02,360 group. 44 00:03:03,570 --> 00:03:04,190 Okay. 45 00:03:04,280 --> 00:03:05,300 Amazing stuff. 46 00:03:05,510 --> 00:03:13,160 Now, the only remaining command that I will discuss in this video is the thought command. 47 00:03:13,370 --> 00:03:18,620 And as you may have expected, the thought command simply sort of failed. 48 00:03:21,370 --> 00:03:24,490 To demonstrate, I created two files. 49 00:03:25,270 --> 00:03:27,800 One called the fruit that the equity and one called. 50 00:03:27,860 --> 00:03:29,150 Number two to 60. 51 00:03:29,980 --> 00:03:33,730 The fruit, two to 60 contains all the fruit I like. 52 00:03:34,420 --> 00:03:36,670 And I really want to get a kiwi right now. 53 00:03:38,230 --> 00:03:44,320 And the number that takes to contain the numbers from one to turn in a random order. 54 00:03:44,440 --> 00:03:45,430 As you can see here. 55 00:03:45,640 --> 00:03:50,770 Now, what if I want to sort the fine fruit? 56 00:03:50,820 --> 00:03:52,820 The texta alphabetically. 57 00:03:53,440 --> 00:03:54,680 I can run the command sort. 58 00:03:55,710 --> 00:03:56,070 Fruit. 59 00:03:56,200 --> 00:04:01,570 The next day, as you can see now, my favorite foods are sorted alphabetically. 60 00:04:01,900 --> 00:04:02,980 Apple, banana, berry. 61 00:04:02,980 --> 00:04:05,280 Kiwi, mango, orange, strawberry. 62 00:04:05,820 --> 00:04:06,120 OK. 63 00:04:06,610 --> 00:04:09,270 What if I do the same thing on the number that 60. 64 00:04:09,730 --> 00:04:09,960 Mm hmm. 65 00:04:10,730 --> 00:04:11,350 Wait a minute. 66 00:04:11,890 --> 00:04:12,970 They are not sorted. 67 00:04:13,180 --> 00:04:15,130 Definitely to change something here. 68 00:04:15,640 --> 00:04:16,930 But they are not sorted. 69 00:04:17,230 --> 00:04:25,770 That's because if you want to sort numbers, you have to pass the dash and option to the sort command. 70 00:04:29,360 --> 00:04:34,030 To 60, as you can see here, my file is sorted. 71 00:04:35,470 --> 00:04:39,070 So here's again, if I see the file. 72 00:04:39,820 --> 00:04:41,830 Now, if I run the dash and. 73 00:04:44,830 --> 00:04:49,690 And you can see it displays the output in a sorted way. 74 00:04:51,460 --> 00:04:52,400 All right. 75 00:04:52,450 --> 00:04:55,750 So this takes us to the end of this video. 76 00:04:55,780 --> 00:04:57,130 I hope you guys enjoyed it. 77 00:04:57,370 --> 00:04:57,880 Chao.