Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have been using Linux for some time now. Now, I have question about auto-completion of commands and directories in a terminal window.

When I press a tab key the terminal auto-completes or gives choice. Is this auto-completion provided by the shell or is it a feature of the emulator.

Also, if its provided by the terminal, how does a terminal provide it so transparently.

share|improve this question
    
See the docs on the GNU Readline library. (The FSF websites are down in protest of SOPA, so you might have to see Google's cache of that page instead.) –  ladaghini Jan 18 '12 at 15:22
add comment

3 Answers

up vote 1 down vote accepted

The shell provides the auto-completion. It's not a separate script but built into the shell itself -- for standard file completion.

Auto-completion on arguments is built on the programmable completion facility built into bash. See the "Programmable Completion" section of the bash man page.

Some Linux distributions provide the bash_completion package. This is a collection of configuration options which utilize the programmable completion commands in bash.

share|improve this answer
add comment

the shell provides this. the terminal emulator draws what the shell produces and hands over user input to the shell.

share|improve this answer
add comment

Auto completion is provided by the shell.
When Tab is pressed, the shell runs a script that decides, based on what you've typed already, what, exactly, needs to be completed. The script then generates a list of possible completions, which may or may not be the list of files in the current directory, or the list of executable files in your $PATH.

share|improve this answer
    
do you know the script that does it. Can a normal user use it? –  Ankit Jan 18 '12 at 15:08
    
The package which enable you to use "arguments completion" (as 'purge' after 'aptitude') is generally named 'bash-completion', see their homepage: bash-completion.alioth.debian.org and the ML Archive lists.alioth.debian.org/pipermail/bash-completion-devel –  Shadok Jan 18 '12 at 15:19
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.