WEBVTT 00:06.620 --> 00:11.360 In this video you're going to continue with permissions in the command line crash course. 00:12.050 --> 00:18.560 So you've seen before how to add permissions to ISIS and type of uses. 00:18.680 --> 00:27.020 Now before moving to the numeric way of dealing with permissions let's remove permissions using the 00:27.020 --> 00:28.260 old way. 00:28.310 --> 00:36.260 So in this example we want to remove the rights and execute permissions for both the group type and 00:36.260 --> 00:37.350 the other type. 00:37.940 --> 00:47.000 So it is since x is change mode group other minus instead of plus for adding permissions. 00:47.070 --> 00:53.170 So minus for removing permissions and then write and execute. 00:53.270 --> 01:01.240 So let's try this by the way to clearly console you can just use the command clear. 01:01.950 --> 01:05.090 So change mode 01:10.920 --> 01:17.180 group and other minus rights and executes. 01:18.420 --> 01:23.680 So before running this command was going to copy its 01:34.760 --> 01:38.740 let's check the current permissions of Upton James 01:41.840 --> 01:48.420 so group and other they have read and then read and executes right. 01:48.530 --> 01:48.980 So 01:54.610 --> 02:03.730 if we run this command then we are removing rights and executes so we don't have any rights. 02:03.730 --> 02:11.060 I would not have an excuse for the group so it's not going to change anything and it's just gonna remove 02:11.060 --> 02:14.420 the executes for other. 02:14.420 --> 02:15.240 So let's try it. 02:17.870 --> 02:23.860 These are the new permissions and you can see that we removed the executes for other. 02:24.030 --> 02:25.770 Now let's try to remove 02:30.850 --> 02:39.000 the right permission for the owner so the owner is going to be you minus rights 02:43.280 --> 02:49.620 and you can see now that the owner has got only the right permission without the right permission. 02:49.640 --> 02:50.030 All right. 02:50.060 --> 02:58.420 So now it's add all permissions to all types of use. 02:58.540 --> 03:07.100 So owner group and other it's odd right. 03:08.650 --> 03:09.210 Right. 03:09.290 --> 03:15.030 Read rights and execute. 03:15.060 --> 03:15.960 Here we go. 03:15.960 --> 03:20.310 They all have read rights and executes permissions. 03:20.880 --> 03:21.150 All right. 03:21.150 --> 03:23.270 Now let's move to the next example. 03:23.310 --> 03:29.550 So this time we want to explore the new way of dealing with permissions using numbers. 03:29.550 --> 03:33.250 So this is a modern way which is less confusing. 03:33.270 --> 03:35.500 That's the old than the old style. 03:35.520 --> 03:39.180 So here we gonna be using numbers. 03:39.840 --> 03:45.910 So each number refers to a combination of permissions. 03:45.930 --> 03:53.300 So for example zero means that we don't have any permission for means. 03:53.300 --> 03:58.510 Thus we have the reed permission but we do have the right or executes permissions. 03:58.590 --> 04:03.470 So the way it works is that each permission has got a corresponding number. 04:03.960 --> 04:10.770 So executes corresponds to one rights is two and read is four. 04:11.160 --> 04:23.360 So a number three for example means does we have got X and doubly so one plus two equals three. 04:23.510 --> 04:29.210 So each of these numbers will correspond to a unique combination. 04:29.270 --> 04:35.120 So 6 refers to two plus four and that's right. 04:35.200 --> 04:38.250 And read a lyric that's right. 04:38.390 --> 04:48.450 Read and write prefix and if you check for example five that's one plus four and you can see that's 04:48.540 --> 04:52.890 five is actually read and execute 04:55.970 --> 05:02.570 execute and write is three right. 05:02.600 --> 05:07.160 So this is how the numeric mode works. 05:07.250 --> 05:19.820 Now if you want to change the permissions of up those days to 7 5 and 1 that means that the user is 05:19.820 --> 05:25.700 gonna have the number 7 meaning that they have all permissions. 05:25.700 --> 05:36.730 The group is going to have number 5 which is 4 plus 1 which is executed and read greed and execute and 05:36.730 --> 05:42.770 one for the other type means that we can only execute. 05:43.020 --> 05:52.940 So let's try this with updates and see the results so change changed mode five seven five one. 05:53.040 --> 05:53.390 Up. 05:53.400 --> 05:54.390 Total Cheers. 05:54.480 --> 05:57.080 And let's see what permissions we have. 05:57.080 --> 06:01.670 And you can see that the owner has got all permissions. 06:01.670 --> 06:11.240 That's the highest number possible the group has got read and executes which is four plus one 5 Five 06:11.960 --> 06:15.250 and other gods only executes. 06:15.350 --> 06:20.270 Which which is one perfect. 06:20.270 --> 06:23.280 Now let's move to the next example. 06:23.690 --> 06:32.510 Now we're going to be manipulating files copying them etc. So to copy a file we just use the CPE command 06:32.600 --> 06:34.490 which stands for copy. 06:34.580 --> 06:36.170 So let's try that. 06:37.340 --> 06:49.340 So create a copy of UB Bill James and call it up to those chance before running the command. 06:49.340 --> 06:52.370 Let's just write some text inside up today as 06:59.720 --> 07:06.290 I know it is copied and let's check what's inside up to Algiers. 07:06.350 --> 07:07.810 It's called the same content. 07:07.870 --> 07:10.650 So this one is a copy of that one. 07:10.690 --> 07:13.910 All right so let's move to the next example. 07:14.100 --> 07:16.770 Now you can also use 07:19.480 --> 07:25.850 a full path of a file if you want to to create a copy. 07:25.900 --> 07:31.390 So let's say that he of course a file OP up the DOJ s inside the root directory. 07:31.390 --> 07:36.670 You can create a copy of that file inside your current directory. 07:36.670 --> 07:38.540 So it is toilers. 07:38.920 --> 07:44.450 So it is go to the root directory. 07:44.520 --> 07:48.790 This creates a file up those charts 07:52.310 --> 07:52.610 OK. 07:52.640 --> 07:59.760 So we can't do that because the current user is not the root user. 07:59.870 --> 08:05.290 So to do this we're going to need to run this command as root. 08:05.320 --> 08:09.490 So what you can do you can just add sudo at the beginning of the command 08:16.850 --> 08:20.230 and he's going to ask you for your password. 08:20.760 --> 08:21.300 OK. 08:21.430 --> 08:28.160 So now if you check the files inside the roots directory you can see up those. 08:28.200 --> 08:30.130 Right the. 08:30.330 --> 08:41.910 So now let's add some text inside up gorgeous so I can open up to J.S. using the vim command 08:45.260 --> 08:48.810 like that and you can see that we of course an empty file. 08:49.010 --> 09:01.910 So if you type of press I These for instance we know I can start inserting texts and I can do anything 09:01.940 --> 09:05.300 I like I can delete facts texts text et cetera. 09:05.440 --> 09:08.480 So it is just odd console the log. 09:08.480 --> 09:13.290 Hello. 09:13.810 --> 09:14.250 OK. 09:14.290 --> 09:26.580 So if I press escape then call on W and then Q to W to write and save the changes q to quit 09:30.500 --> 09:30.860 okay. 09:30.880 --> 09:41.840 So this file is read only because it's actually in the root directory of my computer. 09:43.810 --> 09:48.350 I'm going to cancel all changes for now then great 10:01.010 --> 10:08.340 then I'm going to open this using pseudo now I'm gonna add 10:12.640 --> 10:13.160 text 10:16.440 --> 10:23.600 and then escape w q this time it works right. 10:24.060 --> 10:33.780 So now if I try again vim of up DOJ as you can see what is called some new tax 10:38.280 --> 10:44.540 you could also open the file using brackets if you installed the brackets command line utility like 10:44.540 --> 10:45.200 this. 10:47.900 --> 10:49.700 And here you go you can see 10:52.900 --> 11:00.620 that's what the file open. 11:00.780 --> 11:05.400 Its location is the root directory of the computer 11:13.040 --> 11:17.650 but you're not going to be able to change the file. 11:17.960 --> 11:29.610 So if I change it and try to save then I get an error because I'm not locked in as the roots user. 11:29.610 --> 11:35.370 All right let's close it's. 11:35.430 --> 11:37.940 All right so let's move to the next example. 11:38.010 --> 11:45.570 So all right we wanted to to copy this file into our node folder. 11:45.630 --> 11:50.220 So now let's move to go back to the node folder 11:57.840 --> 12:07.520 so let's go to desktop node and now we want to copy this up DOJ as file which we created in the root 12:07.550 --> 12:19.480 directory of the computer you want to copy it into a file and when to call up 3 those suggests and here 12:19.480 --> 12:19.930 we go. 12:19.930 --> 12:28.060 We've got a new file up three lost J.S. All right. 12:28.580 --> 12:30.350 Now let's move to the next example 12:34.590 --> 12:38.280 now if you want to remove this file 12:43.530 --> 12:49.230 so let's remove up three old you can do that. 12:49.420 --> 12:51.720 And in this case you're going to be prompted. 12:51.960 --> 13:00.310 You're gonna get a confirmation prompts if you want to avoid as you can just use the F option. 13:00.350 --> 13:05.350 Now this file is going to be removed. 13:05.540 --> 13:17.520 Okay so next one this time let's move our file up DOJ us to another folder. 13:17.980 --> 13:24.910 So what we're gonna do we're gonna create a new folder days inside our node folder and then we can move 13:24.910 --> 13:28.160 that file inside that folder. 13:28.420 --> 13:36.220 So to create our new folder we're going to use the make directory command we call it. 13:36.220 --> 13:40.470 I'm gonna call this JS so that's now in your folder. 13:41.210 --> 13:42.660 And let's move 13:45.400 --> 13:50.050 our file up those JS into that folder 13:55.080 --> 14:02.760 and you can either do it like this or specify a new name for your file inside the day as well. 14:03.700 --> 14:11.290 So if you want to call it scripts Borges for example then the new file is going to be scripts those 14:11.290 --> 14:11.740 Jess 14:14.660 --> 14:18.660 so we moved the file from there to that and we renamed it scripts. 14:18.740 --> 14:30.570 Those Das now if you want to move up to those two days to the jazz folder like that and keep the same 14:30.570 --> 14:35.110 name but we all work as well here we go. 14:36.250 --> 14:43.360 All right now let's move to the next example we can rename a file by moving it inside the same folder 14:43.690 --> 14:45.640 by using a new name. 14:45.640 --> 14:53.550 So we going to rename upload J.S. server those days so our upload J.S. file is inside the J.S. folder. 14:53.890 --> 14:59.580 So at the moment we are inside the Janus folder. 14:59.580 --> 15:00.390 All right. 15:00.750 --> 15:03.910 And you've got these two files. 15:03.910 --> 15:06.470 So it is rename up to James 15:11.340 --> 15:12.000 server. 15:12.100 --> 15:12.900 Past tense 15:16.250 --> 15:16.430 here. 15:16.450 --> 15:21.520 Go the name has just changed. 15:21.560 --> 15:22.250 Perfect. 15:22.250 --> 15:24.270 Now let's move to the next one. 15:25.760 --> 15:31.900 Now you can also create a copy of a directory. 15:32.810 --> 15:36.140 So to do that you use the copy command 15:38.760 --> 15:41.700 with the R option. 15:41.820 --> 15:47.480 So this will copy the directory with everything inside it. 15:47.760 --> 15:51.800 So that's the original directory and that's the new directory. 15:51.870 --> 16:02.770 So we're going to move up one directory to the node folder and then we're going to copy the JSC directory 16:03.070 --> 16:12.390 to a new directory as to how we're going to use the r command to copy everything. 16:12.790 --> 16:19.390 So now if you check the tiers to directory and then you can see that it contains everything that you 16:19.390 --> 16:20.250 see inside. 16:20.350 --> 16:23.300 JESS All right. 16:24.290 --> 16:34.760 So there is an improved version using the AIT option and this one will actually preserve file attributes 16:34.790 --> 16:37.640 and copy hidden files as well. 16:37.640 --> 16:38.510 So let's try it. 16:38.870 --> 16:50.310 So before doing this is going to add another folder inside Jess and call it scripts just odd file inside 16:50.310 --> 16:56.580 his JavaScript or JS just to see that everything gets copied. 16:56.660 --> 17:10.310 So this index is a copy minus a copying the J.S. folder like that's into Jess to give us the syntax 17:11.500 --> 17:14.870 and this will copy everything including hidden files. 17:14.870 --> 17:16.100 If you have any hidden files 17:19.800 --> 17:22.390 here you go. 17:22.760 --> 17:28.740 You can also copy a file using a full path like that. 17:29.630 --> 17:37.010 So if you've got a file inside the root directory or any other of your victory you can use its full 17:37.010 --> 17:42.310 part like this to copy it into your directory. 17:42.320 --> 17:42.560 All right. 17:42.560 --> 17:45.680 So now let's move to the next one here. 17:45.680 --> 17:52.520 You can use the outputs of a command to overwrite inside a file. 17:52.520 --> 17:55.670 So you just need to use the grid then sign. 17:55.670 --> 18:00.180 So the outputs of this command is going to be what every echo here. 18:00.220 --> 18:01.520 All right. 18:01.760 --> 18:08.300 Is going to be written or overwritten inside our Apple Genius. 18:08.450 --> 18:10.980 So let's try this. 18:11.500 --> 18:14.850 So let's see where we are at the moment. 18:15.010 --> 18:16.990 Let's move to Jess 18:20.210 --> 18:25.880 and let's write into scripts though Jess 18:31.800 --> 18:32.730 so echo 18:42.960 --> 18:44.400 console that that log. 18:44.400 --> 18:45.140 Hello. 18:45.180 --> 18:47.670 So this output 18:50.910 --> 18:55.710 will be written into our file scripts though J is like these 19:00.360 --> 19:04.940 I can see that we have overwritten whatever we had inside scripts. 19:04.940 --> 19:05.680 No Jess. 19:05.690 --> 19:12.710 Now if you want to append to upload JS inside of overwriting it you can do that by using double agrees 19:12.740 --> 19:13.200 then sign. 19:13.590 --> 19:15.760 So let's try those 19:20.000 --> 19:25.850 so let's append for example another console that log. 19:25.850 --> 19:29.980 Hello my you can see that this time 19:35.990 --> 19:37.800 we've got two lines inside. 19:37.800 --> 19:41.280 Scripts dos James and this is our new line. 19:41.450 --> 19:41.810 Perfect. 19:41.810 --> 19:45.620 So in the next video you're going to move to the next example.