Hello, the beautiful people.
And in this video, we're going to be wrapping up our discussion of how to navigate the Linux file system
using the command line.
And in this video, you're going to learn how to use tab auto completion to speed up your navigation
of the file system.
And we're also going to have a recap of what everything that we've learned about navigating the file
system in the past few videos.
By the end of this video, you're going to have all the knowledge that you need to navigate the file
system like a pro.
Just add practice and you're going to get plenty of that as we go through the course.
So to get the final few pieces of information about TAB Auto completion, let's go ahead and jump right
into it.
Okay.
So let's go ahead and learn about a really awesome feature known as TAB Completion.
Now at the minute, we're currently in our home directory, as you can see, by looking at the shell
prompt and also by using the P command, we see that we're in our home directory.
Now we could actually jump all the way to the base directory of the system by just typing CD and then
a slash.
And if I do that, you'll see that if we use the print working directory command, we can see that we
are in the base directory of our system.
And I want to do this just to highlight that you don't have to go folder by folder when you're using
the CD command, you can actually just jump all the way around your system.
So for example, if I wanted to jump all the way to my desktop, I don't have to go CD then slash you
know, I don't have to go step by step all the way through.
I can just say CD, give it the tilde and then say because that's my home folder and then say desktop.
Okay.
And there we are.
We end up in the desktop.
So you can use the CD command to jump around.
You don't just have to go step by step.
Okay.
So cleaning the screen, let's go ahead and now learn about tab completion.
So let's say that we wanted to get all the way to my home directory using an absolute path.
We could do that simply by just typing it all out, right?
We could type CD, slash home, slash Ziad, and if we want to go to documents, we could type slash
documents.
We would be there.
We would get all the way to the documents folder.
But typing that out, it takes a bit of time, it's error prone and we're kind of lazy as programmers.
So we want speed and we want things to be without errors and we want things to work right the first
time.
So that's where tab completion comes in.
Let's head back to our home.
Let's head back to the very base directory and clear the screen.
P wd were in the base directory.
This is how you could use tab completion to get there.
Remember, we want to get to the documents folder.
So that's going to be like this.
That's where we're trying to get to.
So let's see how we would get there.
We type CD, then a slash.
Now instead of typing out home, we could just type out H and press the tab and you'll see that the
shell automatically completed that piece of text for us.
That's pretty cool.
Let's try and type out Ziad.
So we just type Z and then we press tab and it's filled out my name.
Awesome.
Right now let's say we want to go into documents.
Okay, let's let's try a capital D and press tab.
Now, why isn't that working?
Let's try again.
Okay.
Well, it's not working.
Well, the reason is this Capital D could refer to lots of things in our home folder, so let's take
a look at it.
If we go to our home folder here, clear the screen and take a look.
You can see that the capital D could refer to the desktop, it could refer to the downloads or it could
refer to the documents.
And it's the documents that we want.
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
press it once.
It won't work if I press it twice, really quickly, just like that it will actually.
It's a lot.
It will actually let me clear the screen.
It will press it twice.
It will actually tell us which ones it matches.
Okay.
So we want to go into documents if I type doc because if I type doh and double tap, that's still no
good because it could go for documents or download.
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
documents folder.
So that's awesome.
And it cut down our level of typing and error proneness massively.
So if we go all the way back to the root directory now, we can just type C, D, slash tab, z, tab,
dos tab.
There we are in the documents folder.
So that's really, really cool.
This will work for file names just like it will for folders and it's amazing and I use it all the time.
Now there's one final awesome trick.
Let's navigate to the desktop the graphical way.
So we're going to open, we're going to go into the goo and we're going to get to the desktop.
Let's actually open a terminal so that the shell is operating from in this directory you can right click
and you'll notice that you'll see an option here that says open in terminal.
Okay.
So if we click that, you can see that we've got a terminal that's automatically opened in the desktop.
So say for example, you're doing stuff and you're navigating files in your I don't know, in your,
your, your documents folder.
We've got some files in here.
Let's say then you could actually just right click and click open in terminal and you're directly now
operating in your terminal from within that documents folder.
So if you're doing stuff graphically and then you want to switch to the terminal and then switch back
and this is a nice shortcut to be able to use.
Okay.
So you've learnt a whole bunch of stuff in the last three videos or so about navigating the Linux file
system.
So I just wanted to take a bit of time to have a quick recap of what we have learned to make sure that
it's all sunk in so you know that you use the P command to print the current working directory that
the shell is operating in, and it will print out an absolute path to where on the file system your
shell is currently operating.
You can use the RLS command to see what's around you when you are in that directory.
It just lists out the contents of the directory.
Folders are in blue and files are in white, but you can make that easier to see using the the capital
F option.
And we went through several other options that the RLS command can have to make viewing things and viewing
files in the in the command line a lot easier.
You saw that the CD command can be used to change directory or move to a new location on the file system.
And you saw that absolute paths are paths that start at the very base directory of the file system.
So the slash and relative paths are the paths that start from the directory that your shell is currently
in.
So relative paths are usually easier to type, but absolute paths are very clear as to where they end
up.
Now every directory has the dot and dot dot hidden folders that you can see using the LS command with
the a option and the dot the one dot is four means the current folder and the two dots refer to the
parent folder of where you currently are.
So if you did CD and then did dot dot, that would move you up a folder because it's saying go up,
go to the parent folder of where I currently am.
And if you did CD Dot, then that will just basically keep you where you are.
It wouldn't make any difference.
Okay, now tab auto completion.
We saw in this video and we saw that tab auto completion is a really useful technique to speed up typing
and avoiding errors.
And if you press tab and nothing happens, just hit tab twice really quickly and it will show you several
options that are conflicting.
And you can just then type out a bit more to make sure that it selects the one you want.
So like we saw when we when we type the capital D, it wasn't working.
But if we press tab twice, we could see that it was clashing with documents, downloads and desktop
and then we could modify it there on to make sure tab auto completion worked.
But you'll use Tab auto completion all the time.
It saves you so much time and so much hassle.
It's a great, great feature that the shell has and it can also be used anywhere, not just when navigating.
So if you're if you are, you know, trying to enter an argument to a command and it's a file path,
you can use tab auto completion to there as well.
It's not just when using CD or LHS or whatever it might be.
You can use it for pretty much any command.
And if you want to open up a terminal where you currently are, when you're navigating graphically using
the graphical user interface, just right click and click open in terminal and a terminal will open
up with the current directory being exactly where you were when you opened that terminal.
So that's a really useful feature as well.
If you just need to make some quick edits on the terminal and then shut it again and get back to doing
what you were graphically, it's a great, great feature, so make sure you keep a hold of that.
So we've called a whole bunch of stuff in the last few videos and now you should start feeling comfortable
with how to navigate.
You just use p tab to see where you are.
LS To look around and CD to move and in the next video we're going to start discussing file extensions
in Linux because they don't work like they might do on other operating systems.
And there's quite a few cool freedoms that file extensions that you have when working in Linux.
So for that goodness, I'll see you in the next video.