1 00:00:00,000 --> 00:00:12,120 [Intro music] 2 00:00:12,120 --> 00:00:17,340 Command syntax. Every time you run a command, you 3 00:00:17,340 --> 00:00:24,630 have the option, and you have argument. Command 4 00:00:24,630 --> 00:00:28,800 typically have the syntax like command, like as if 5 00:00:28,800 --> 00:00:32,070 you are running command, let's say ls, it's a 6 00:00:32,070 --> 00:00:35,790 listing command, the option is going to be the 7 00:00:35,790 --> 00:00:39,930 -l or ltr, whatever we use in argument if 8 00:00:39,930 --> 00:00:43,410 you are looking for a specific file. Now, what are 9 00:00:43,410 --> 00:00:47,520 the options again? It modifies the way that a 10 00:00:47,520 --> 00:00:51,720 command works. It usually consist of a hyphen or a 11 00:00:51,720 --> 00:00:56,640 dash, followed by a single letter. Sometimes some 12 00:00:56,640 --> 00:00:59,820 commands accept multiple options, which can 13 00:00:59,820 --> 00:01:03,390 usually be grouped together for a single hyphen. 14 00:01:04,590 --> 00:01:08,280 And what are the arguments? Most commands are used 15 00:01:08,280 --> 00:01:12,960 together with one or more arguments. Some commands 16 00:01:12,990 --> 00:01:17,580 assume a default argument if none is supplied, and 17 00:01:17,580 --> 00:01:20,760 arguments are optional for some commands and 18 00:01:20,760 --> 00:01:25,080 required by others. Let's look at our Linux 19 00:01:25,080 --> 00:01:28,410 machine and I will explain you exactly how the 20 00:01:28,410 --> 00:01:29,995 command syntax works. 21 00:01:29,995 --> 00:01:37,695 [No audio] 22 00:01:37,695 --> 00:01:39,060 So we are in this Linux 23 00:01:39,060 --> 00:01:41,910 machine. Again, the first thing you always have to 24 00:01:41,910 --> 00:01:46,380 do is find out who are you or which user 25 00:01:46,410 --> 00:01:50,040 are you logged in as. So you do whoami, you are 26 00:01:50,040 --> 00:01:53,220 yourself. Second thing, which directory you are in? 27 00:01:53,790 --> 00:01:58,350 you are in slash home and slash your user. This is 28 00:01:58,350 --> 00:02:00,750 your home directory. And by the way, every time 29 00:02:00,750 --> 00:02:04,170 you start to type cd, no matter which directory you 30 00:02:04,170 --> 00:02:06,120 are in, you're always going to come back to your 31 00:02:06,120 --> 00:02:09,900 home directory. Now when I mean by command, so the 32 00:02:09,900 --> 00:02:13,289 first, when we run command ls in your directory, 33 00:02:13,680 --> 00:02:17,460 you will see all the directories and files it has, 34 00:02:17,700 --> 00:02:21,510 without other details that you get. So when you 35 00:02:21,510 --> 00:02:27,270 use the option, so you do ls -l, this will 36 00:02:27,270 --> 00:02:31,980 list everything that you have in your home 37 00:02:31,980 --> 00:02:36,540 directory. And then it will also give you all the 38 00:02:36,540 --> 00:02:38,970 details whether it's a directory, 39 00:02:38,970 --> 00:02:42,060 file, size, who owns it, and all the bunch of 40 00:02:42,060 --> 00:02:44,790 stuff. So you adding the option with the 41 00:02:44,790 --> 00:02:48,420 -l. So options can also be grouped. When 42 00:02:48,420 --> 00:02:53,490 I'm meant the group, it means ls -l, and you 43 00:02:53,490 --> 00:02:58,050 could add another option to it, which is t. So you 44 00:02:58,050 --> 00:03:03,750 see, it will let list all the contents of your 45 00:03:03,750 --> 00:03:08,730 directory by the time they were created. Then when 46 00:03:08,730 --> 00:03:13,230 you do another option with that ls -ltr, it 47 00:03:13,230 --> 00:03:16,110 will still give you the all the listing, but it 48 00:03:16,110 --> 00:03:19,410 will list all the newest files or directories 49 00:03:19,650 --> 00:03:22,080 starting at the bottom and the oldest one from the 50 00:03:22,080 --> 00:03:26,100 top. So that covers our ls as a command. And then 51 00:03:26,100 --> 00:03:30,454 the second one is the option which we use ls -ltr. 52 00:03:30,454 --> 00:03:35,520 And what do we mean by argument? Let's look 53 00:03:35,520 --> 00:03:36,938 at the argument again. 54 00:03:36,938 --> 00:03:39,155 [No audio] 55 00:03:39,155 --> 00:03:41,310 Argument can be used to be 56 00:03:41,460 --> 00:03:44,640 more specific, meaning let's say if you wanted to 57 00:03:44,640 --> 00:03:50,868 know just a file, bart, so you do ls -l bart. 58 00:03:50,868 --> 00:03:56,880 This is going to only list the file bart. If 59 00:03:56,880 --> 00:03:59,430 you want to know the details about the file bart, 60 00:04:00,060 --> 00:04:02,760 who owns it, was a permission on it, you could just 61 00:04:02,760 --> 00:04:06,300 use that argument to list this. Now you have 62 00:04:06,300 --> 00:04:10,800 command, you have option, and you have argument. If 63 00:04:10,800 --> 00:04:16,200 you wanted to, let's say delete a directory, which 64 00:04:16,200 --> 00:04:22,055 is by the way the command to delete is rm, remove, -f, 65 00:04:22,055 --> 00:04:24,660 which is to remove without asking you 66 00:04:24,839 --> 00:04:28,590 whether they should delete it or not, so you could 67 00:04:28,590 --> 00:04:30,480 just do rm -f. 68 00:04:31,770 --> 00:04:36,840 And then let's say I want to remove seinfeld. And 69 00:04:36,840 --> 00:04:40,770 when you hit Enter, it's gonna say cannot remove 70 00:04:40,800 --> 00:04:44,850 seinfeld, Is a directory. So we have to use an 71 00:04:44,880 --> 00:04:48,720 option to remove it and to remove a directory 72 00:04:48,720 --> 00:04:52,680 with an option, it is, so let's say if this time we 73 00:04:52,680 --> 00:04:57,150 will take out f, and we just do r. So r is an option 74 00:04:57,150 --> 00:05:00,210 to remove a directory, so when you hit enter, it 75 00:05:00,210 --> 00:05:03,570 will remove the seinfeld. And how do you validate 76 00:05:03,570 --> 00:05:06,150 that? You do ls -ltr, and you're going to 77 00:05:06,150 --> 00:05:09,540 see in your listing seinfeld directory is gone. 78 00:05:10,440 --> 00:05:14,250 And I want you to recreate it again, it's mkdir 79 00:05:14,250 --> 00:05:17,190 [No author] 80 00:05:17,190 --> 00:05:22,350 seinfeld, you do ls -ltr, and there you go. 81 00:05:22,350 --> 00:05:26,520 This has at the bottom, it has your new directory 82 00:05:26,520 --> 00:05:31,050 seinfeld. So again, to wrap up this lesson, we 83 00:05:31,050 --> 00:05:36,810 covered the command, the option, and argument. And 84 00:05:36,810 --> 00:05:40,050 the best way to find out which options you have 85 00:05:40,050 --> 00:05:43,380 available with the command you always run man, 86 00:05:43,830 --> 00:05:47,250 which is stands for manual, and ls, which is the 87 00:05:47,250 --> 00:05:51,600 command. When you hit enter, it will give you a 88 00:05:51,600 --> 00:05:54,450 user command, a manual, which will give you all the 89 00:05:54,480 --> 00:05:57,990 options like if you run -a, it will ignore 90 00:05:57,990 --> 00:06:01,890 entry starting with dot, if you uppercase, A, B, 91 00:06:02,970 --> 00:06:07,110 and C, and so on, and you could just hit space to 92 00:06:07,110 --> 00:06:10,410 go down and see other option. Keep hitting space, 93 00:06:10,440 --> 00:06:13,770 keep hitting space, keep hitting space, and you'll 94 00:06:13,770 --> 00:06:16,170 see all the different options, and by the time you 95 00:06:16,170 --> 00:06:18,810 get to the bottom and you cannot hit the base 96 00:06:18,810 --> 00:06:22,560 anymore, you could just hit Q to get your prompt 97 00:06:22,560 --> 00:06:27,810 back. You could also run a man ls, hit enter. And 98 00:06:27,810 --> 00:06:30,690 if you just want to view the first page without 99 00:06:30,690 --> 00:06:33,690 going any further, you could just simply quit out 100 00:06:33,690 --> 00:06:35,790 of it right away instead of just hitting space, 101 00:06:35,790 --> 00:06:39,870 space and go to the end, so you hit Q. So this is 102 00:06:40,260 --> 00:06:43,470 what primarily we covered in this lesson. Again, 103 00:06:43,470 --> 00:06:45,488 command, option, and argument. 104 00:06:45,488 --> 00:06:47,616 [No audio]