1 00:00:00,550 --> 00:00:01,990 Hello, my name is Typhoon. 2 00:00:01,990 --> 00:00:07,750 And in this lecture of our course, you will learn about lot of things about Linux command line. 3 00:00:07,750 --> 00:00:09,070 So let's get started. 4 00:00:22,400 --> 00:00:28,790 When you work in the Windows, Mac OS and most other operating systems, you probably spend your time 5 00:00:28,790 --> 00:00:34,490 running applications like web browsers, word processors, spreadsheets and games. 6 00:00:34,520 --> 00:00:41,730 A typical application is packed with features everything that designers or their users will need. 7 00:00:41,750 --> 00:00:44,360 So most applications are self-sufficient. 8 00:00:44,630 --> 00:00:53,330 They don't rely on other applications, so you might copy and paste between applications from time to 9 00:00:53,330 --> 00:00:56,660 time, but for the most part they are separate. 10 00:00:56,780 --> 00:01:01,130 But the Linux command line is different. 11 00:01:01,160 --> 00:01:07,640 Instead of big applications with tons of features, Linux supplies thousands of small commands with 12 00:01:07,640 --> 00:01:08,960 very few features. 13 00:01:08,990 --> 00:01:11,150 The command cat, for example. 14 00:01:11,150 --> 00:01:15,500 Cat the for example, the print files on the screen. 15 00:01:15,500 --> 00:01:16,220 That's about it. 16 00:01:16,220 --> 00:01:23,840 So the less files, less here, less command lists, the file in a directory, MV renames files and 17 00:01:23,840 --> 00:01:24,320 so on. 18 00:01:24,320 --> 00:01:28,580 So each command has a simple, fairly well-defined purpose. 19 00:01:28,610 --> 00:01:30,990 What if you need to do something more complicated? 20 00:01:31,010 --> 00:01:31,550 Don't worry. 21 00:01:31,700 --> 00:01:40,400 So Linux makes it easy to combine commands so their individual features work together as accomplish 22 00:01:40,400 --> 00:01:40,930 your goal. 23 00:01:40,940 --> 00:01:45,740 So this way of working yields a very different mindset about computing. 24 00:01:45,770 --> 00:01:52,790 Instead of asking which application should I launch to achieve some results, the question becomes which 25 00:01:52,790 --> 00:01:55,940 command should I combine? 26 00:01:56,120 --> 00:02:02,300 In this lecture, you will learn about how to arrange and run commands in different combinations. 27 00:02:02,300 --> 00:02:05,420 To do what you need to keep things simple. 28 00:02:05,420 --> 00:02:13,070 I will introduce just six Linux commands and their most basic uses so you can focus on the more complex 29 00:02:13,070 --> 00:02:18,680 and interesting part about that, combining them with a huge learning curve. 30 00:02:18,710 --> 00:02:26,640 So it's a bit like learning to cook with six ingredients or learning carpentry with just a hammer and 31 00:02:26,640 --> 00:02:26,960 saw. 32 00:02:26,970 --> 00:02:31,050 So you will combine commands using pipes. 33 00:02:31,380 --> 00:02:34,230 And here this is a pipe here in Linux. 34 00:02:34,230 --> 00:02:42,840 So this is the Linux feature that connects the output of one command to the output of another. 35 00:02:42,840 --> 00:02:46,290 So let me open my driver here. 36 00:02:46,320 --> 00:02:49,500 Jiffy Yeah, Grommet NP here. 37 00:02:49,500 --> 00:02:50,250 So. 38 00:02:51,170 --> 00:02:52,790 It takes one here. 39 00:02:52,790 --> 00:02:55,030 So if you have here. 40 00:02:55,040 --> 00:02:55,450 Yeah. 41 00:02:55,460 --> 00:02:56,240 Toggle painting. 42 00:02:56,240 --> 00:02:56,770 Yeah. 43 00:02:56,780 --> 00:02:59,480 If you have one here, for example, this is our one result. 44 00:02:59,480 --> 00:03:04,850 If you make pipe between them like this, this will take here and put it here. 45 00:03:05,390 --> 00:03:06,350 So. 46 00:03:07,690 --> 00:03:10,390 We will example will be practical for daily use. 47 00:03:10,390 --> 00:03:16,300 So while others are just toy examples to demonstrate an important feature. 48 00:03:16,390 --> 00:03:22,900 So let's get started with input output and pipes in Linux here. 49 00:03:23,260 --> 00:03:24,550 Uh, yes, actually. 50 00:03:24,550 --> 00:03:27,660 How can we clear screen shift and home? 51 00:03:27,670 --> 00:03:29,440 Yes, clear screen here. 52 00:03:29,470 --> 00:03:34,360 So most linux commands read input from keyboard. 53 00:03:35,360 --> 00:03:37,950 Write output to the screen or both. 54 00:03:37,970 --> 00:03:41,330 So Linux has fancy names for the reading and writing. 55 00:03:41,330 --> 00:03:42,410 For example. 56 00:03:42,800 --> 00:03:43,760 STD in. 57 00:03:43,880 --> 00:03:45,560 STD in here. 58 00:03:45,560 --> 00:03:47,810 So this is actually not a comment, but just I want to talk. 59 00:03:47,870 --> 00:03:48,740 About this. 60 00:03:48,740 --> 00:03:54,500 So this STD in is standard input or standard in so this is a stream. 61 00:03:54,530 --> 00:03:58,970 Of input that Linux reads from your keyboard. 62 00:03:58,970 --> 00:04:05,750 So when you type any comments at the prompt, you are displaying data on STD in. 63 00:04:05,840 --> 00:04:12,920 And we also have the STD out pronounced as the standard output or standard out. 64 00:04:12,950 --> 00:04:16,970 So this is the stream of the output that Linux writes to your display. 65 00:04:16,970 --> 00:04:25,010 So when you run the command, for example, to print file names, the result appears on STD out. 66 00:04:25,010 --> 00:04:33,170 So now this comes the cool part here so you can connect the STD out of one command to the STD in of 67 00:04:33,170 --> 00:04:33,650 another. 68 00:04:33,750 --> 00:04:35,790 So the first command feeds the second. 69 00:04:35,790 --> 00:04:39,870 So let's begin with the familiar LSL command here. 70 00:04:39,870 --> 00:04:43,140 So LSL and been here, for example. 71 00:04:43,590 --> 00:04:48,900 So as you can see here, the directory contains far more files. 72 00:04:48,900 --> 00:04:54,240 For example, if you have directory contains the file more files than your display has lines. 73 00:04:54,240 --> 00:04:58,110 So the output quickly scrolls off the screen here. 74 00:04:58,110 --> 00:05:04,720 As you can see, it's a it's a shame that the LHS can't print the information on screen and full at 75 00:05:04,720 --> 00:05:05,130 the time. 76 00:05:05,130 --> 00:05:13,860 So pausing until you press a key to continue here so like this or for example, s m home oops, home. 77 00:05:13,860 --> 00:05:16,710 And as you can see here, we got this. 78 00:05:16,830 --> 00:05:17,700 So. 79 00:05:19,300 --> 00:05:27,670 Asexual also used a less here for example my file and as you can see we don't have a my file so the 80 00:05:27,670 --> 00:05:34,420 last command displays a file on a screenful at a time so you can connect this to your commands because 81 00:05:34,810 --> 00:05:39,160 writes the stdout and less can read from the stdin. 82 00:05:39,160 --> 00:05:42,970 So for example ls ls l here? 83 00:05:42,970 --> 00:05:44,500 So let's clear? 84 00:05:44,530 --> 00:05:45,220 Yeah. 85 00:05:45,430 --> 00:05:53,580 LS l here bin And this is a pipe here, so use a pipe to send the output from L. 86 00:05:53,590 --> 00:05:55,840 S to bin here. 87 00:05:55,840 --> 00:05:57,610 So not like this here. 88 00:05:57,610 --> 00:06:05,530 So use a pipe to send output from ls to the input of less here. 89 00:06:05,530 --> 00:06:08,770 So in this case the less is going to be less. 90 00:06:08,770 --> 00:06:10,360 And just add. 91 00:06:10,360 --> 00:06:15,460 And as you can see here, we got an a screen here like this oops. 92 00:06:15,610 --> 00:06:16,230 Here. 93 00:06:16,480 --> 00:06:16,930 So it. 94 00:06:16,930 --> 00:06:17,500 Yeah. 95 00:06:19,820 --> 00:06:20,180 Here. 96 00:06:21,130 --> 00:06:22,150 As you can see here. 97 00:06:22,150 --> 00:06:27,250 So the combined command displays the directory contents one screenful at a time here. 98 00:06:27,250 --> 00:06:28,630 So the vertical. 99 00:06:29,460 --> 00:06:33,810 But here vertical path that we've written here. 100 00:06:35,570 --> 00:06:36,400 Yes. 101 00:06:36,410 --> 00:06:40,220 Uh, here, press return to quick here. 102 00:06:40,220 --> 00:06:44,690 Or for example, let's lsl home like this. 103 00:06:44,690 --> 00:06:48,440 And as you can see here, we've written like the output here. 104 00:06:50,360 --> 00:06:50,990 Like this. 105 00:06:52,060 --> 00:06:55,360 So first commands is stdout to the next command. 106 00:06:55,750 --> 00:06:59,330 And so any command line containing pipe is called. 107 00:06:59,350 --> 00:07:00,250 Pipeline. 108 00:07:00,250 --> 00:07:03,610 So commands generally are not aware that they are part of a pipeline. 109 00:07:03,610 --> 00:07:11,530 So unless believes it's writing to the display when the expected output has been redirected to less 110 00:07:11,530 --> 00:07:17,410 here so and less believes it's reading from the keyboard when it's actually reading from the output 111 00:07:17,410 --> 00:07:19,150 of a less.