O'Reilly logo

The Linux Command Line by William E. Shotts Jr.

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Completion

Another way that the shell can help you is through a mechanism called completion. Completion occurs when you press the tab key while typing a command. Let’s see how this works. Say your home directory looks like this:

[me@linuxbox ˜]$ ls
Desktop    ls-output.txt  Pictures  Templates      Videos
Documents  Music          Public

Try typing the following but don’t press the enter key:

[me@linuxbox ˜]$ ls l

Now press the tab key:

[me@linuxbox ˜]$ ls ls-output.txt

See how the shell completed the line for you? Let’s try another one. Again, don’t press enter:

[me@linuxbox ˜]$ ls D

Press tab :

[me@linuxbox ˜]$ ls D

No completion—just a beep. This happened because D matches more than one entry in the directory. For completion to be successful, the “clue” you give it has ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required