...
Expand | |||||
---|---|---|---|---|---|
| |||||
The command prompt "follows you", displaying /stor/work/CBRS_unix when you're in that directory, and ~ when you're in your Home directory. |
Tab key completion
The Tab key is your best friend! Hit the Tab key once or twice - it's almost magic!
Hitting Tab invokes shell completion, instructing the shell to try to guess what you're doing and finish the typing for you.
On most modern Linux shells you use Tab completion by pressing:
- single Tab – completes file or directory name up to any ambiguous part
- if nothing shows up, there is no unambiguous match
- Tab twice – display all possible completions
- you then decide where to go next
Let's have some fun with the Tab key. Follow along if you can:
Code Block | ||
---|---|---|
| ||
cd /st # hit Tab key - expands to /stor/ which is the only match
cd /stor/w # hit Tab key again - expands to /stor/work/, again the only match
cd /stor/work/C # hit Tab once - nothing happens because there are multiple matches
cd /stor/work/C # hit Tab a 2nd time - all matching directories listed
cd /stor/work/CB # hit Tab key - expands to /stor/work/CBRS_unix
cd /stor/work/CBRS_unix # press Enter to change to that directory
cd # go Home |
Relative pathname syntax
Rather than always typing a full pathname (that is, a pathname starting with the / root directory) of where you want to go, you can specify a directory relative to where you are. This is where the special directory names .
(single period = current directory) and ..
(double period = parent of current directory) come in handy.
...