Hdi2u S11
From wiki
Tab completion
- Fear of the command line often means, fear of typing too much. Everybody fears this, so there are tools.
- Tab completion is probably the most important tool, and relies on your pressing the
TAB
key
- It tries to complete the filename or program name you have started typing, saving you typing time and reducing spelling errors.
cd kir
- followed by
TAB
. If there is only one directory with a name starting with the letters "kir", the rest of the name will be completed for you.
- if there are several options, you need to supply more "hint-letters" and press
TAB
multiple times.
Exercises
- Type
ls testseq
and use tab completion.
- This will show you a list of files that start with testseq.
- You now have the option of completing the filename yourself, or "tabbing" through the filenames available.
- It limits itself to files in your current directory.
- What happens if you type
TAB
immediately after ls
?
- How can you find out all commands available on the system?
Answer
- The first word of a command line is usually a command, so TAB looks for commands, not files.
- By giving no hints at all to TAB, it will look for all possible commands.