1 00:00:00,060 --> 00:00:01,050 Below the beautiful people. 2 00:00:01,050 --> 00:00:04,590 And welcome to part two of navigating the Linux file system. 3 00:00:04,590 --> 00:00:09,360 So in this video, we're going to build upon what we learned in the last video about using the P, e 4 00:00:09,420 --> 00:00:10,740 and the LS commands. 5 00:00:10,740 --> 00:00:16,830 But in this video you're going to learn how to use the C command to actually move around the file system. 6 00:00:16,830 --> 00:00:20,220 You're going to learn the difference between absolute and relative file paths. 7 00:00:20,250 --> 00:00:25,080 You can learn some awesome keyboard shortcuts that will make navigating the file system so quick and 8 00:00:25,080 --> 00:00:25,770 so easy. 9 00:00:25,770 --> 00:00:32,640 And you basically going to see how you can put together the PWT, the LS and the CD commands to elegantly 10 00:00:32,640 --> 00:00:34,410 navigate the file system. 11 00:00:34,410 --> 00:00:38,940 And by the end of this video you're going to know everything that you need to know about navigating 12 00:00:38,940 --> 00:00:42,990 the Linux file system, using the command line, and you watch with a bit of practice. 13 00:00:42,990 --> 00:00:48,150 You'll soon agree with me that doing it this way is a lot faster and a lot more effective than using 14 00:00:48,150 --> 00:00:53,400 your pointy clicky graphical methods that you've been using probably all of your life so far. 15 00:00:53,400 --> 00:00:57,990 So let's go ahead and jump right into this next part of your superhero training. 16 00:00:58,470 --> 00:00:58,980 Okay. 17 00:00:58,980 --> 00:01:04,560 So in the last video we saw that we could use the P.W DX command to see where we were on the file system. 18 00:01:04,560 --> 00:01:09,450 And we saw that we could use the LZ command with a variety of different options to basically look around 19 00:01:09,450 --> 00:01:11,550 and list what was in the directory that we're in. 20 00:01:11,550 --> 00:01:15,330 But using just these two commands, we're kind of stuck in the one place, right? 21 00:01:15,330 --> 00:01:18,950 How can we actually move from our home directory? 22 00:01:18,960 --> 00:01:25,530 Well, the missing piece is the C DX command and the CD command stands for Change Directory. 23 00:01:25,530 --> 00:01:30,780 So let's say that we used our RLS command and we saw that the downloads folder by noticing that it's 24 00:01:30,780 --> 00:01:35,070 in blue, it's a folder we wanted to go into the downloads folder. 25 00:01:35,070 --> 00:01:36,150 How would we do that? 26 00:01:36,150 --> 00:01:37,920 Well, we could do it in a few ways. 27 00:01:37,920 --> 00:01:42,510 Firstly, we could give the CD command the absolute path for where we want to go. 28 00:01:42,510 --> 00:01:44,610 We could go starting at the base directory. 29 00:01:44,610 --> 00:01:52,140 We'd go Slash, then home, then Ziad, then downloads, and we could type that in like that and that 30 00:01:52,140 --> 00:01:53,220 would totally work. 31 00:01:54,000 --> 00:01:59,760 Or if we didn't want to have to write out the entire path to our home directory, we could just replace 32 00:01:59,760 --> 00:02:00,720 all that with the tilde. 33 00:02:00,720 --> 00:02:04,860 And we say, okay, go change to our home directory and then downloads. 34 00:02:04,860 --> 00:02:07,110 That's where you'd use the tilde and nice little shortcut. 35 00:02:07,260 --> 00:02:12,030 Or what we could use is something known as a relative path. 36 00:02:12,030 --> 00:02:17,370 Now a relative path is a path relative to where you currently are. 37 00:02:17,760 --> 00:02:22,530 So because we're currently in the home folder, how do we get to the downloads folder? 38 00:02:22,650 --> 00:02:23,670 Well, let's think about it. 39 00:02:23,670 --> 00:02:28,890 If we open up the graphical the graphical menu, here we are, we're in the home folder from here. 40 00:02:28,890 --> 00:02:31,260 What do we do to get to the downloads folder? 41 00:02:32,380 --> 00:02:36,700 We literally all we have to do is just click downloads, right? 42 00:02:36,700 --> 00:02:39,430 So that you can say that that's a relative path. 43 00:02:39,430 --> 00:02:41,650 We're just going from here to the downloads. 44 00:02:41,650 --> 00:02:42,820 That's all we've got to do. 45 00:02:42,820 --> 00:02:48,850 So to change to the downloads folder, all we've got to do is type downloads. 46 00:02:49,300 --> 00:02:56,620 So if we do that, if we just type CD and then downloads just like that and press enter, you can see 47 00:02:56,620 --> 00:03:00,100 that we have changed directory and our shell prompt has changed as well. 48 00:03:00,100 --> 00:03:04,240 Before it was just the tilde telling us that we were in our home directory. 49 00:03:04,250 --> 00:03:08,640 Now it's saying we're in our home directory and the downloads folder inside that. 50 00:03:08,650 --> 00:03:14,620 Okay, so this is this text in blue here shows us the path to where we currently are and if we use the 51 00:03:14,620 --> 00:03:21,310 P command now, we can see that we get slash home, slash Z slash downloads, and we can also look around 52 00:03:21,310 --> 00:03:25,930 by pressing the RLS command and we can see that there's actually nothing inside that folder. 53 00:03:26,110 --> 00:03:26,500 Okay. 54 00:03:26,500 --> 00:03:29,740 So now that we're in our downloads folder, here's a challenge for you. 55 00:03:29,890 --> 00:03:36,820 Go ahead and pause the video and see if you can use the CD command to change back to our home directory. 56 00:03:36,820 --> 00:03:40,660 So go ahead and pause the video and give it a shot and then come back to see how you did. 57 00:03:46,950 --> 00:03:47,640 Did you manage it? 58 00:03:47,670 --> 00:03:49,810 If so, really, really well done. 59 00:03:49,830 --> 00:03:51,490 You learn super quickly. 60 00:03:51,510 --> 00:03:54,570 Now, you could have done it using an absolute path like this. 61 00:03:54,570 --> 00:03:58,470 You could type CD, then slash home, slash your username, whatever it would be. 62 00:03:58,470 --> 00:04:01,260 In my case, Ziad Slash and that's it. 63 00:04:01,560 --> 00:04:02,340 That would work. 64 00:04:02,340 --> 00:04:05,640 Or you could have used a tilde to make it nice and easy. 65 00:04:05,640 --> 00:04:08,040 Just use CD and then a tilde. 66 00:04:08,310 --> 00:04:12,330 Now I kind of cheat it a little bit because there's another way that you could have done it, and this 67 00:04:12,330 --> 00:04:14,550 is the way you're probably do it from now on. 68 00:04:14,850 --> 00:04:20,279 But I haven't shown you this before now by default, if you don't give it any input, the CD command 69 00:04:20,279 --> 00:04:22,560 will take you to your home folder. 70 00:04:22,560 --> 00:04:28,140 So if we just type CD like from scratch to type CD and press enter, you can see by this looking at 71 00:04:28,140 --> 00:04:33,270 the shell prompt that we've ended up back in our home directory, we can use PWT to confirm that and 72 00:04:33,270 --> 00:04:39,570 it tells us that we are back in our home directory and that will work no matter where I was previously 73 00:04:39,570 --> 00:04:40,500 on the file system. 74 00:04:40,500 --> 00:04:44,580 I could have been anywhere on the file system and all I've got to do is type, CD and press enter and 75 00:04:44,580 --> 00:04:47,090 I will end up back in the home directory. 76 00:04:47,100 --> 00:04:47,970 Pretty cool, right? 77 00:04:48,270 --> 00:04:48,960 Okay, great. 78 00:04:48,960 --> 00:04:54,090 So now that we're back in the home folder, I want to show you a very useful option for the RLS command. 79 00:04:54,090 --> 00:04:56,760 That's kind of like wearing x ray glasses. 80 00:04:56,760 --> 00:04:58,260 And it's the A option. 81 00:04:58,260 --> 00:05:04,380 Now, the A option is short for all and it allows you to see all of the files in a directory, even 82 00:05:04,380 --> 00:05:05,520 the hidden files. 83 00:05:05,520 --> 00:05:12,720 So if I type RLS and give it the a option now if I press enter, you'll notice that we see a whole lot 84 00:05:12,720 --> 00:05:13,560 of stuff in here. 85 00:05:13,560 --> 00:05:14,190 Print it out. 86 00:05:14,400 --> 00:05:19,170 If I clear the screen and type you just the RLS option and then show you the RLS with the A option, 87 00:05:19,170 --> 00:05:22,650 you'll see we get a lot more stuff with the option. 88 00:05:22,650 --> 00:05:28,650 Now a lot of these files, you'll notice, have far names beginning with dots, and that means that 89 00:05:28,650 --> 00:05:31,740 they're hidden files or even hidden directories. 90 00:05:31,740 --> 00:05:37,290 Okay, now, if we look in the graphical editor, we may not be able to actually see them by default. 91 00:05:37,290 --> 00:05:42,150 But if we click up here like we did in the last few videos and show hidden files, we can now see them 92 00:05:42,150 --> 00:05:42,570 as well. 93 00:05:42,570 --> 00:05:44,850 So you look you can see that we're getting exactly the same output. 94 00:05:44,850 --> 00:05:51,060 So that's how you show hidden files using the using the the the RLS command. 95 00:05:51,510 --> 00:05:57,210 And you may also notice in here that we've got our bash alias file that we made a few videos ago. 96 00:05:57,210 --> 00:06:03,660 Now the reason that I mention this is because there's two very important hidden folders inside each 97 00:06:03,660 --> 00:06:04,350 folder. 98 00:06:04,950 --> 00:06:08,790 They are the dot and the double dot folders. 99 00:06:09,030 --> 00:06:13,800 Now these are shortcuts that allow you to move around easier or refer to stuff on your file system a 100 00:06:13,800 --> 00:06:14,490 whole lot easier. 101 00:06:14,490 --> 00:06:18,960 Now the dot folder simply refers to the current directory. 102 00:06:19,320 --> 00:06:26,130 So for example, if I go to the desktop folder and then we can print, my apologies if we can do print 103 00:06:26,130 --> 00:06:31,290 work in directory and we can see that we have that we're in the desktop and if I list its contents, 104 00:06:31,560 --> 00:06:37,710 there shouldn't really be anything on my desktop, but there always is this dot and double dot folders 105 00:06:37,710 --> 00:06:40,200 which are only visible using the LS with the option. 106 00:06:40,200 --> 00:06:41,940 If I just do normal ls it doesn't show up. 107 00:06:41,940 --> 00:06:43,940 If I do ls a they show up. 108 00:06:43,950 --> 00:06:47,970 Okay, now in here we've got the dot and the double dot folders. 109 00:06:48,000 --> 00:06:56,310 If I try to do seed to the dot folder, bash is basically going to stay where it is. 110 00:06:56,310 --> 00:06:57,960 The shell is going to stay exactly where it is. 111 00:06:57,960 --> 00:06:58,860 So if I do that. 112 00:07:00,100 --> 00:07:04,270 You can see that we're still in the desktop, but looking at the shell prompt because the DOT folder 113 00:07:04,270 --> 00:07:07,640 refers to the current folder that we're in. 114 00:07:07,660 --> 00:07:08,030 Okay. 115 00:07:08,110 --> 00:07:10,420 It's just a way of saying this folder. 116 00:07:10,840 --> 00:07:11,320 Okay. 117 00:07:11,410 --> 00:07:13,730 Now, what if I went to the double dot? 118 00:07:13,750 --> 00:07:15,520 Well, if I do CD doubled up. 119 00:07:15,550 --> 00:07:16,210 Okay. 120 00:07:16,890 --> 00:07:21,300 You notice that we did actually change and we're in fact back in our home folder. 121 00:07:21,330 --> 00:07:28,560 The double dot folder means the parent folder or the folder above where we currently are. 122 00:07:28,590 --> 00:07:28,930 Okay. 123 00:07:29,070 --> 00:07:32,880 So if I go back to the desktop, you can see that we've got the double dot folder. 124 00:07:32,880 --> 00:07:34,170 If I press CD Double Dot. 125 00:07:34,200 --> 00:07:37,920 We've gone back up a folder, which brings us into the home directory. 126 00:07:38,160 --> 00:07:39,510 So we're back in our home directory. 127 00:07:39,540 --> 00:07:40,500 Let's clear the screen. 128 00:07:40,620 --> 00:07:42,270 What if I kept going? 129 00:07:42,780 --> 00:07:50,700 If I go CD, dot, dot, I'm now in the actual home folder, which is not my home folder, but it's 130 00:07:50,700 --> 00:07:53,130 the folder above my home folder. 131 00:07:53,270 --> 00:07:54,270 Okay, let's keep going. 132 00:07:54,300 --> 00:07:55,440 CD, dot, dot. 133 00:07:55,500 --> 00:07:59,910 And now we're actually just in the slash folder. 134 00:07:59,910 --> 00:08:03,460 We're in the base directory for the whole system. 135 00:08:03,780 --> 00:08:09,000 Okay, see if we can go any higher if we go CD, dot, dot, you can see that we can't go any higher 136 00:08:09,000 --> 00:08:14,310 because the the dat, the slash folder is the highest point on the file system. 137 00:08:15,300 --> 00:08:16,260 We can actually have a look around. 138 00:08:16,260 --> 00:08:18,900 If I do an LZ, what's in our base directory? 139 00:08:19,560 --> 00:08:23,100 We can see there's quite a lot of files here that you saw when we had a little bit of an explanation 140 00:08:23,100 --> 00:08:24,930 of the file system. 141 00:08:24,930 --> 00:08:29,370 You've got the bin folder, the boot folder, the dev folder, the ETSI folder, which is full of your 142 00:08:29,370 --> 00:08:34,470 configuration files, the home folder, which is where we just were to get our home stuff, the libraries, 143 00:08:34,710 --> 00:08:41,460 media, which is where you have your removable hard drives, your optional stuff, the root users home 144 00:08:41,460 --> 00:08:43,309 folder and so on and so on. 145 00:08:43,320 --> 00:08:47,010 The the variable files, temp files, user stuff and so on and so on. 146 00:08:47,020 --> 00:08:48,690 Okay, these are the folders. 147 00:08:48,810 --> 00:08:52,650 And the most important of these anyway are the ones that I gave you in that cheat sheet where we talked 148 00:08:52,650 --> 00:08:54,660 about the file system. 149 00:08:55,050 --> 00:08:56,830 And now let's see what happens now. 150 00:08:56,850 --> 00:08:59,030 This is the root user's home folder, right? 151 00:08:59,040 --> 00:09:02,010 This is the home folder for the administrator. 152 00:09:03,210 --> 00:09:05,370 Let's try and see what happens if we try to enter it. 153 00:09:05,370 --> 00:09:12,030 If we do CD root and press enter, you can see that we get permission denied. 154 00:09:12,330 --> 00:09:17,280 So there's some folders that you're allowed into and some folders that you're not allowed into. 155 00:09:17,400 --> 00:09:22,460 So we don't have enough privileges to be able to access the root users home directory or. 156 00:09:22,470 --> 00:09:23,770 Well, what about the C folder? 157 00:09:23,970 --> 00:09:25,110 The one with the configuration files. 158 00:09:25,120 --> 00:09:25,710 Let's try that. 159 00:09:25,710 --> 00:09:27,560 If we try cd etsi. 160 00:09:28,260 --> 00:09:28,560 Aha. 161 00:09:28,650 --> 00:09:29,550 We can get into that one. 162 00:09:29,550 --> 00:09:31,260 Let's see what's in there if we press LHS. 163 00:09:31,560 --> 00:09:34,200 Oh you can see there's a whole bunch of stuff in there. 164 00:09:34,200 --> 00:09:35,820 Right, and there's some folders in here. 165 00:09:35,830 --> 00:09:40,980 The blue ones are folders and the white ones are files and some of them have different types as well. 166 00:09:40,980 --> 00:09:42,330 But you don't have to worry about that. 167 00:09:42,330 --> 00:09:47,910 Mostly what you'll see are blue and white, blue ones folders, white one files, and you can enter 168 00:09:47,910 --> 00:09:48,990 anything that you want in there. 169 00:09:48,990 --> 00:09:50,430 For example, there's one here. 170 00:09:50,910 --> 00:09:52,040 Where are we looking? 171 00:09:52,050 --> 00:09:53,940 There's one here called HCP. 172 00:09:53,970 --> 00:09:57,360 We could go into that folder, we could try CD, DHCP. 173 00:09:58,470 --> 00:09:59,910 Now what's in there? 174 00:10:00,090 --> 00:10:01,920 We could do ls and we could have a look around. 175 00:10:01,920 --> 00:10:03,270 We can see there's other stuff in there. 176 00:10:03,270 --> 00:10:04,200 There's another one there. 177 00:10:04,200 --> 00:10:07,470 DD Client enter XD Let's try to go there. 178 00:10:07,560 --> 00:10:11,670 DD Client dash enter dash hooks dot. 179 00:10:11,670 --> 00:10:13,260 DD You can see that we're in there. 180 00:10:13,260 --> 00:10:14,010 What's in there? 181 00:10:14,130 --> 00:10:16,320 Two LS We can see there's other stuff in there. 182 00:10:16,320 --> 00:10:18,330 The green ones here are programs. 183 00:10:18,420 --> 00:10:26,370 But you can see here, right the way that we are moving around the file system using either CD to move 184 00:10:26,370 --> 00:10:31,470 ls to see what's around us or d to confirm exactly where we are. 185 00:10:31,470 --> 00:10:35,430 And it's this way that you will actually move around the entire system. 186 00:10:35,430 --> 00:10:37,830 And it doesn't change no matter where you are. 187 00:10:37,830 --> 00:10:42,660 As long as you've got the permissions to enter those folders, you can get there using just the CD command 188 00:10:42,660 --> 00:10:46,890 and you can look around using the LS command and you can confirm where you are using the P command. 189 00:10:46,980 --> 00:10:49,560 Now how do we get all the way back to our home folder? 190 00:10:49,560 --> 00:10:50,370 Very easy. 191 00:10:50,370 --> 00:10:55,770 Just press CD, press enter and we are back in our home folder. 192 00:10:55,770 --> 00:11:00,120 So you can see that pretty much anything that you need to do in the Linux file system, anywhere in 193 00:11:00,120 --> 00:11:03,630 the Linux file system that you want to move to as long as you have the required permissions, all you 194 00:11:03,630 --> 00:11:08,040 need are the CD LS and DVD commands and you can get wherever you want. 195 00:11:08,040 --> 00:11:10,890 And if you get lost, just use the CD command to check where you are. 196 00:11:10,890 --> 00:11:11,850 Pretty epic, right? 197 00:11:11,850 --> 00:11:16,980 So now that we're back in our home folder, there's one final thing that I want to teach you, and that's 198 00:11:16,980 --> 00:11:18,810 called tab completion. 199 00:11:19,140 --> 00:11:23,310 But for that goodness, as well as a summary of everything we've learned in the past few videos. 200 00:11:23,310 --> 00:11:25,560 I'll see you in the next video.