WEBVTT

00:01.420 --> 00:01.720
Hello.

00:01.720 --> 00:06.070
In this lecture you will learn about the TAB autocomplete in Linux.

00:06.070 --> 00:07.240
So let's get started.

00:23.700 --> 00:28.320
So when I'm working at the command line, you can easily mistype a command directory name or a file

00:28.320 --> 00:28.590
name.

00:28.590 --> 00:36.480
In fact, the longer directory reference or a file name, the greater chance you have on mistyping it.

00:39.850 --> 00:43.670
This is where our autocomplete can be a lifesaver.

00:43.690 --> 00:50.260
So the autocomplete allows you to start typing a file name or a directory name and then press a tab

00:50.260 --> 00:53.500
key to have the shell complete it for you.

00:53.530 --> 00:58.630
So, for example, in this case, we have LZ, and as you can see, we have my test file, my test file

00:58.660 --> 01:03.460
two and my very, very 219 lengthy file here.

01:03.580 --> 01:10.780
And so when you write like this, LZ, my here.

01:11.720 --> 01:15.950
And you will shove directories that start with my and underscore.

01:16.100 --> 01:19.700
So when you want to copy here for example.

01:21.870 --> 01:27.840
Yeah so copy my vary or my here and as you can see we have several options.

01:27.840 --> 01:32.460
Whenever I click on the top I'm going through these files here.

01:32.460 --> 01:40.650
So after selecting the tab here and press enter your choosing file and here after that we will, for

01:40.650 --> 01:46.350
example, enter in new file, new file.

01:46.350 --> 01:51.810
And here we copied our my very, very lengthy file to new file here.

01:51.810 --> 01:55.860
So ls ls l here?

01:55.860 --> 02:03.270
And as you can see here, the new file is just created in that time here, as you can see here.

02:03.270 --> 02:13.170
134 So in this example, we typed a CP and then press the tab key or we have the actual type, the my

02:13.620 --> 02:19.410
here my and we press the tab key and then shell autocomplete the rest of the file name.

02:19.410 --> 02:26.140
Of course, the destination directory had to be typed, but still Autocomplete saved the command from

02:26.140 --> 02:31.330
a several potential typographical errors.

02:31.330 --> 02:39.130
So the trick to using the autocomplete is to give the shell enough file name characters so it can distinguish

02:39.130 --> 02:41.410
the desired file from the other files.

02:41.410 --> 02:45.220
For example, if the another file name started with, for example.

02:45.220 --> 02:45.790
Really?

02:45.790 --> 02:48.190
Or let's actually try what we have.

02:48.220 --> 02:48.460
Yeah.

02:48.460 --> 02:56.620
If another file name started with test here, pressing the keyword here or like this ls.

02:57.570 --> 02:58.650
Past and present.

02:58.650 --> 03:08.190
The key word here that starts with T here will show us our potential files that we are searching for.

03:08.280 --> 03:12.520
So instead, you would hear a beep if you don't have anything.

03:12.540 --> 03:13.330
To show you.

03:13.350 --> 03:18.720
So if this happens, you can press the tab key again and the shell shows you.

03:18.750 --> 03:21.630
All the file names started with.

03:21.990 --> 03:22.380
Really?

03:22.380 --> 03:28.080
So this feature allows you to see what needs to be typed for.

03:28.170 --> 03:31.350
Tab autocomplete to work properly.
