In Chapter 1, Tab completed command names. It also completes the names in a path. This saves typing and stops typing errors.
cd shyou type
Tab
cd shop/
o, Tab
cd shop/orders/
The rules are the same
| After Tab | Meaning |
|---|---|
| The name is complete | One item matches |
| A list, after the second Tab | More than one item matches |
| Nothing, after two pushes | No item matches |
Directories end with /
When the completed name is a directory, the shell adds /. You can type the next name at once, or push Tab again to see what is in the directory.
It works with every kind of path
Tab completes relative paths, absolute paths, and paths with ~ or ..:
text
cat ~/sh⇥ → cat ~/shop/
cat ../pr⇥ → cat ../prices.txt
ls /et⇥ → ls /etc/