Filename Completion

One common feature of a shell is filename completion. All of the shells that are preinstalled on your virtual server, with the exception of the Bourne shell (sh), include filename completion.

After typing the first few letters of a command or filename, you can usually have the shell automatically complete the rest of the command or filename by hitting the [TAB] key on the keyboard. If more than one file begins with the same string of characters, the file name will be completed only to the point at which the character strings differ.

Example: Suppose you have the following files within the same directory:

> ls

freebie

freedom

freewill

Now, suppose you wish to delete the freebie file. You might try typing the following command:

> rm fr[TAB]

However, after the filename completion, the following would display:

> rm free

Because there is more than one match, the filename completion cannot continue beyond the point at which the strings are identical. To complete the filename, you must:

> rm freeb[TAB]

Efficient use of the tab completion feature of a shell can save you a lot of time and keystrokes.