View the Most Wanted LQ Wiki articles.
LinuxQuestions.org > Linux Wiki > Tab filename completion

From LQWiki

Jump to: navigation, search

When you use the bash shell on Linux it will complete commands and file names for you if you type the 'TAB' key. The default behaviour is:

  1. You type in the start of the command or filename.
  2. You hit TAB.
  3. The shell will fill in as much as it can and beep.
  4. Hit TAB again and it shows you all possible matches.

Example:

  • You want to start firefox and type only firef and then the 'TAB' key.
  • You want to know which commands starting with 'f' exist, so you type 'f' and then the 'TAB' key twice.

The default behavior be changed to:

  1. You type in the start of the command or filename.
  2. You hit TAB.
  3. The shell will fill in as much as it can and beep.

All that needs to be done is:

  1. Edit /etc/inputrc
  2. Add the line:
set show-all-if-ambiguous on

Personal tools