One of the cool features of the bash shell is command argument completion, with which you can type just part of a command, press , and have bash complete the command for you (Code Listing 3.8).
bash-2.00$ ls Complete NewProject bogus2 → ftp puppy Completed News dead.letter → mail temp Mail access files → public_html testme bash-2.00$ cd public_html/ bash-2.00$ |
1. | ls -l Use ls -l to list the files in your current directory. |
2. | cd pub
Type in a partial command, then press to complete the command. In this example, we typed the cd command and part of the public_html directory (truncated to pub in the example), then pressed to complete it (see Code Listing 3.8). |
✓ Tips
Completion works only if there’s just one possible match to the letters you type before you hit . For example, if you type cd pu (for public_html) and there’s another subdirectory called puppy, the shell will beep and wait for you to type in enough letters to distinguish the two subdirectories.
You can use completion to complete commands, directory names within commands, and nearly anything else you might enter that’s sufficiently unambiguous.