1 00:00:00,150 --> 00:00:01,530 Hello, the beautiful people. 2 00:00:01,530 --> 00:00:06,750 And in this video, we're going to be wrapping up our discussion of how to navigate the Linux file system 3 00:00:06,750 --> 00:00:08,100 using the command line. 4 00:00:08,100 --> 00:00:13,740 And in this video, you're going to learn how to use tab auto completion to speed up your navigation 5 00:00:13,740 --> 00:00:14,490 of the file system. 6 00:00:14,490 --> 00:00:19,080 And we're also going to have a recap of what everything that we've learned about navigating the file 7 00:00:19,080 --> 00:00:21,450 system in the past few videos. 8 00:00:21,630 --> 00:00:26,040 By the end of this video, you're going to have all the knowledge that you need to navigate the file 9 00:00:26,040 --> 00:00:27,270 system like a pro. 10 00:00:27,270 --> 00:00:31,500 Just add practice and you're going to get plenty of that as we go through the course. 11 00:00:31,500 --> 00:00:37,200 So to get the final few pieces of information about TAB Auto completion, let's go ahead and jump right 12 00:00:37,200 --> 00:00:37,860 into it. 13 00:00:39,250 --> 00:00:39,470 Okay. 14 00:00:39,780 --> 00:00:44,480 So let's go ahead and learn about a really awesome feature known as TAB Completion. 15 00:00:44,490 --> 00:00:48,300 Now at the minute, we're currently in our home directory, as you can see, by looking at the shell 16 00:00:48,300 --> 00:00:52,810 prompt and also by using the P command, we see that we're in our home directory. 17 00:00:52,830 --> 00:00:59,400 Now we could actually jump all the way to the base directory of the system by just typing CD and then 18 00:00:59,400 --> 00:01:00,030 a slash. 19 00:01:00,030 --> 00:01:04,530 And if I do that, you'll see that if we use the print working directory command, we can see that we 20 00:01:04,530 --> 00:01:06,210 are in the base directory of our system. 21 00:01:06,210 --> 00:01:10,650 And I want to do this just to highlight that you don't have to go folder by folder when you're using 22 00:01:10,650 --> 00:01:13,590 the CD command, you can actually just jump all the way around your system. 23 00:01:13,590 --> 00:01:20,520 So for example, if I wanted to jump all the way to my desktop, I don't have to go CD then slash you 24 00:01:20,520 --> 00:01:22,560 know, I don't have to go step by step all the way through. 25 00:01:22,560 --> 00:01:28,140 I can just say CD, give it the tilde and then say because that's my home folder and then say desktop. 26 00:01:28,140 --> 00:01:28,580 Okay. 27 00:01:28,830 --> 00:01:29,340 And there we are. 28 00:01:29,340 --> 00:01:31,290 We end up in the desktop. 29 00:01:31,290 --> 00:01:33,360 So you can use the CD command to jump around. 30 00:01:33,360 --> 00:01:34,980 You don't just have to go step by step. 31 00:01:35,010 --> 00:01:35,250 Okay. 32 00:01:35,310 --> 00:01:38,940 So cleaning the screen, let's go ahead and now learn about tab completion. 33 00:01:38,940 --> 00:01:44,280 So let's say that we wanted to get all the way to my home directory using an absolute path. 34 00:01:45,510 --> 00:01:48,230 We could do that simply by just typing it all out, right? 35 00:01:48,240 --> 00:01:53,580 We could type CD, slash home, slash Ziad, and if we want to go to documents, we could type slash 36 00:01:53,580 --> 00:01:54,180 documents. 37 00:01:54,480 --> 00:01:56,250 We would be there. 38 00:01:56,460 --> 00:01:58,560 We would get all the way to the documents folder. 39 00:01:58,560 --> 00:02:04,080 But typing that out, it takes a bit of time, it's error prone and we're kind of lazy as programmers. 40 00:02:04,260 --> 00:02:09,419 So we want speed and we want things to be without errors and we want things to work right the first 41 00:02:09,419 --> 00:02:09,780 time. 42 00:02:09,780 --> 00:02:12,120 So that's where tab completion comes in. 43 00:02:12,840 --> 00:02:13,890 Let's head back to our home. 44 00:02:13,890 --> 00:02:16,800 Let's head back to the very base directory and clear the screen. 45 00:02:16,800 --> 00:02:18,600 P wd were in the base directory. 46 00:02:19,260 --> 00:02:22,860 This is how you could use tab completion to get there. 47 00:02:22,860 --> 00:02:25,050 Remember, we want to get to the documents folder. 48 00:02:25,470 --> 00:02:27,390 So that's going to be like this. 49 00:02:28,290 --> 00:02:30,120 That's where we're trying to get to. 50 00:02:30,330 --> 00:02:31,800 So let's see how we would get there. 51 00:02:31,800 --> 00:02:33,750 We type CD, then a slash. 52 00:02:33,990 --> 00:02:40,230 Now instead of typing out home, we could just type out H and press the tab and you'll see that the 53 00:02:40,230 --> 00:02:44,610 shell automatically completed that piece of text for us. 54 00:02:44,710 --> 00:02:45,720 That's pretty cool. 55 00:02:45,720 --> 00:02:46,920 Let's try and type out Ziad. 56 00:02:46,920 --> 00:02:51,270 So we just type Z and then we press tab and it's filled out my name. 57 00:02:51,330 --> 00:02:51,900 Awesome. 58 00:02:51,900 --> 00:02:55,920 Right now let's say we want to go into documents. 59 00:02:55,950 --> 00:03:00,360 Okay, let's let's try a capital D and press tab. 60 00:03:02,040 --> 00:03:03,630 Now, why isn't that working? 61 00:03:04,170 --> 00:03:04,890 Let's try again. 62 00:03:05,730 --> 00:03:05,840 Okay. 63 00:03:06,000 --> 00:03:06,810 Well, it's not working. 64 00:03:06,810 --> 00:03:13,440 Well, the reason is this Capital D could refer to lots of things in our home folder, so let's take 65 00:03:13,440 --> 00:03:14,010 a look at it. 66 00:03:14,010 --> 00:03:18,660 If we go to our home folder here, clear the screen and take a look. 67 00:03:18,660 --> 00:03:23,640 You can see that the capital D could refer to the desktop, it could refer to the downloads or it could 68 00:03:23,640 --> 00:03:24,870 refer to the documents. 69 00:03:24,870 --> 00:03:26,370 And it's the documents that we want. 70 00:03:26,910 --> 00:03:35,610 So if I if I now if I say, okay, I want to go to the capital D here and press tab twice, well, just 71 00:03:35,610 --> 00:03:36,030 press it once. 72 00:03:36,030 --> 00:03:40,650 It won't work if I press it twice, really quickly, just like that it will actually. 73 00:03:40,950 --> 00:03:41,700 It's a lot. 74 00:03:41,760 --> 00:03:43,650 It will actually let me clear the screen. 75 00:03:43,740 --> 00:03:45,540 It will press it twice. 76 00:03:45,540 --> 00:03:48,960 It will actually tell us which ones it matches. 77 00:03:48,990 --> 00:03:49,490 Okay. 78 00:03:49,530 --> 00:03:55,470 So we want to go into documents if I type doc because if I type doh and double tap, that's still no 79 00:03:55,470 --> 00:03:57,540 good because it could go for documents or download. 80 00:03:57,550 --> 00:04:04,350 So if I type doc and then press tab now it's going to go to documents and there we are, we're in the 81 00:04:04,350 --> 00:04:05,190 documents folder. 82 00:04:05,190 --> 00:04:06,060 So that's awesome. 83 00:04:06,060 --> 00:04:09,330 And it cut down our level of typing and error proneness massively. 84 00:04:09,330 --> 00:04:15,930 So if we go all the way back to the root directory now, we can just type C, D, slash tab, z, tab, 85 00:04:15,930 --> 00:04:17,430 dos tab. 86 00:04:17,820 --> 00:04:19,500 There we are in the documents folder. 87 00:04:19,709 --> 00:04:20,820 So that's really, really cool. 88 00:04:20,820 --> 00:04:27,450 This will work for file names just like it will for folders and it's amazing and I use it all the time. 89 00:04:27,870 --> 00:04:29,820 Now there's one final awesome trick. 90 00:04:29,820 --> 00:04:31,830 Let's navigate to the desktop the graphical way. 91 00:04:32,250 --> 00:04:36,030 So we're going to open, we're going to go into the goo and we're going to get to the desktop. 92 00:04:36,360 --> 00:04:43,200 Let's actually open a terminal so that the shell is operating from in this directory you can right click 93 00:04:43,380 --> 00:04:48,030 and you'll notice that you'll see an option here that says open in terminal. 94 00:04:48,060 --> 00:04:48,320 Okay. 95 00:04:48,450 --> 00:04:55,650 So if we click that, you can see that we've got a terminal that's automatically opened in the desktop. 96 00:04:55,650 --> 00:05:00,900 So say for example, you're doing stuff and you're navigating files in your I don't know, in your, 97 00:05:00,900 --> 00:05:02,220 your, your documents folder. 98 00:05:02,490 --> 00:05:03,630 We've got some files in here. 99 00:05:03,630 --> 00:05:10,140 Let's say then you could actually just right click and click open in terminal and you're directly now 100 00:05:10,140 --> 00:05:13,440 operating in your terminal from within that documents folder. 101 00:05:13,440 --> 00:05:17,340 So if you're doing stuff graphically and then you want to switch to the terminal and then switch back 102 00:05:17,340 --> 00:05:19,800 and this is a nice shortcut to be able to use. 103 00:05:21,240 --> 00:05:21,630 Okay. 104 00:05:21,630 --> 00:05:28,500 So you've learnt a whole bunch of stuff in the last three videos or so about navigating the Linux file 105 00:05:28,500 --> 00:05:28,830 system. 106 00:05:28,830 --> 00:05:33,690 So I just wanted to take a bit of time to have a quick recap of what we have learned to make sure that 107 00:05:33,690 --> 00:05:40,770 it's all sunk in so you know that you use the P command to print the current working directory that 108 00:05:40,770 --> 00:05:46,860 the shell is operating in, and it will print out an absolute path to where on the file system your 109 00:05:46,860 --> 00:05:49,230 shell is currently operating. 110 00:05:49,380 --> 00:05:53,670 You can use the RLS command to see what's around you when you are in that directory. 111 00:05:53,670 --> 00:05:57,240 It just lists out the contents of the directory. 112 00:05:57,240 --> 00:06:03,630 Folders are in blue and files are in white, but you can make that easier to see using the the capital 113 00:06:03,630 --> 00:06:04,260 F option. 114 00:06:04,260 --> 00:06:09,510 And we went through several other options that the RLS command can have to make viewing things and viewing 115 00:06:09,510 --> 00:06:12,210 files in the in the command line a lot easier. 116 00:06:12,390 --> 00:06:19,080 You saw that the CD command can be used to change directory or move to a new location on the file system. 117 00:06:19,320 --> 00:06:25,980 And you saw that absolute paths are paths that start at the very base directory of the file system. 118 00:06:25,980 --> 00:06:31,890 So the slash and relative paths are the paths that start from the directory that your shell is currently 119 00:06:31,890 --> 00:06:32,370 in. 120 00:06:32,370 --> 00:06:38,160 So relative paths are usually easier to type, but absolute paths are very clear as to where they end 121 00:06:38,160 --> 00:06:38,490 up. 122 00:06:39,180 --> 00:06:45,360 Now every directory has the dot and dot dot hidden folders that you can see using the LS command with 123 00:06:45,360 --> 00:06:54,390 the a option and the dot the one dot is four means the current folder and the two dots refer to the 124 00:06:54,390 --> 00:06:56,670 parent folder of where you currently are. 125 00:06:56,670 --> 00:07:03,270 So if you did CD and then did dot dot, that would move you up a folder because it's saying go up, 126 00:07:03,270 --> 00:07:05,370 go to the parent folder of where I currently am. 127 00:07:05,370 --> 00:07:08,820 And if you did CD Dot, then that will just basically keep you where you are. 128 00:07:08,820 --> 00:07:10,110 It wouldn't make any difference. 129 00:07:10,190 --> 00:07:12,390 Okay, now tab auto completion. 130 00:07:12,390 --> 00:07:17,490 We saw in this video and we saw that tab auto completion is a really useful technique to speed up typing 131 00:07:17,490 --> 00:07:18,510 and avoiding errors. 132 00:07:18,510 --> 00:07:24,840 And if you press tab and nothing happens, just hit tab twice really quickly and it will show you several 133 00:07:24,840 --> 00:07:26,190 options that are conflicting. 134 00:07:26,190 --> 00:07:29,730 And you can just then type out a bit more to make sure that it selects the one you want. 135 00:07:29,730 --> 00:07:33,270 So like we saw when we when we type the capital D, it wasn't working. 136 00:07:33,270 --> 00:07:37,800 But if we press tab twice, we could see that it was clashing with documents, downloads and desktop 137 00:07:37,800 --> 00:07:41,400 and then we could modify it there on to make sure tab auto completion worked. 138 00:07:41,400 --> 00:07:44,370 But you'll use Tab auto completion all the time. 139 00:07:44,370 --> 00:07:46,980 It saves you so much time and so much hassle. 140 00:07:46,980 --> 00:07:52,740 It's a great, great feature that the shell has and it can also be used anywhere, not just when navigating. 141 00:07:52,740 --> 00:07:59,490 So if you're if you are, you know, trying to enter an argument to a command and it's a file path, 142 00:07:59,490 --> 00:08:02,280 you can use tab auto completion to there as well. 143 00:08:02,280 --> 00:08:05,310 It's not just when using CD or LHS or whatever it might be. 144 00:08:05,310 --> 00:08:07,230 You can use it for pretty much any command. 145 00:08:07,350 --> 00:08:12,810 And if you want to open up a terminal where you currently are, when you're navigating graphically using 146 00:08:12,810 --> 00:08:18,420 the graphical user interface, just right click and click open in terminal and a terminal will open 147 00:08:18,420 --> 00:08:24,210 up with the current directory being exactly where you were when you opened that terminal. 148 00:08:24,360 --> 00:08:25,860 So that's a really useful feature as well. 149 00:08:25,860 --> 00:08:29,490 If you just need to make some quick edits on the terminal and then shut it again and get back to doing 150 00:08:29,490 --> 00:08:33,780 what you were graphically, it's a great, great feature, so make sure you keep a hold of that. 151 00:08:33,780 --> 00:08:38,250 So we've called a whole bunch of stuff in the last few videos and now you should start feeling comfortable 152 00:08:38,250 --> 00:08:39,179 with how to navigate. 153 00:08:39,179 --> 00:08:41,520 You just use p tab to see where you are. 154 00:08:41,549 --> 00:08:47,280 LS To look around and CD to move and in the next video we're going to start discussing file extensions 155 00:08:47,280 --> 00:08:51,270 in Linux because they don't work like they might do on other operating systems. 156 00:08:51,270 --> 00:08:55,800 And there's quite a few cool freedoms that file extensions that you have when working in Linux. 157 00:08:55,800 --> 00:08:59,310 So for that goodness, I'll see you in the next video.