Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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

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

share|improve this answer

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: and the ML Archive – Shadok Jan 18 '12 at 15:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .