O'Reilly logo

From Bash to Z Shell: Conquering the Command Line by Peter Stephenson, Jerry Peek, Oliver Kiddle

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

CHAPTER 10Completion

Shell completion started out in the C shell as a way to save the user effort when typing out long filenames. The user types the first few characters of a filename and presses a special key such as Tab or Esc. The shell then completes the remaining characters of the filename. Consider the following example:

% ls index.html  intro.html  links.html % cat l<tab>

expands to

% cat links.html

As you can see, I want to review links.html, and I only had to type the first letter and then press the Tab key, prompting the shell to complete the filename for me. It's quite a convenient feature indeed!

Modern shells have extended this basic idea well beyond its original scope. All manner of things can be completed: filenames, usernames, ...

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