Celeb Glow
general | February 28, 2026

Ubuntu terminal, How do I "tab" (autocomplete) a filename window-cmd-style(cycle options)?

Basically i want to change ubuntu terminal functionally, so that i can cycle thru all the options when i tab(on the cmd line row) and not list the options as it is per default?

Im using bash, ubuntu 9.04. I see some possibilities in ".bashrc", but there must be someone out there who already solved this problem?

5

2 Answers

According to the comments on this page, putting

bind '"\t":menu-complete'

in your .bashrc should enable cyclic tab completion.

See section 8.4.6 of the Bash Reference Manual for more information.

2

Something that is a life-saver for me is to have bash cycle through the possibilities instead of showing a dumb list.

As bash is using readline for its auto-completion, add the following lines to ~/.inputrc

Once you're satisfied and have thoroughly tested below solution for a few days/weeks, cut and paste (don't copy!) the same settings from ~/.inputrc to /etc/inputrc which contains the system-wide settings, making this available to all users on your system (including guest).

The codez:

# mappings to have up and down arrow searching through history:
"\e[A": history-search-backward
"\e[B": history-search-forward
# mappings to have left and right arrow go left and right:
"\e[C": forward-char
"\e[D": backward-char
# mapping to have [Tab] and [Shift]+[Tab] to cycle through all the possible completions:
"\t": menu-complete
"\e[Z": menu-complete-backward

then exit your terminal (or remote terminal like putty) and open it again...

Examples:

  1. When you have 3 files: file1, file2 and file3 and you type:

    e fTabTabTab

    it'll cycle through:

    e file1
    e file2
    e file3

    and when you want to go back, just hit Shift+Tab

  2. When you type:

    very-complicated-command with lots of command line parameters

    and next time you need the same command, you just type:

    very

    and it'll type for you:

    very-complicated-command with lots of command line parameters

This will save you a ton of time in bash! ;-)

Source

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy