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

Is there a way to get colored output when using tab completion in a terminal? My colors are fine everywhere else so I know that I've enabled a color terminal successfully.

Using bash in Ubuntu (10.10).

share|improve this question
How do you specify a "colored output when using tab completion"? – slhck Feb 27 '11 at 19:51
up vote 8 down vote accepted

There's no facility within Bash to color output during completion as there is in fish and zsh. One could write completion functions that output color control sequences, but you'd have to maintain copies of the proposed completions with and without color codes or strip the out when the user makes a selection since Bash uses the selection directly normally and the color codes would get in the way.

If this is an important feature for you, I would recommend that you consider using zsh.


Bash 4.3 readline adds a variable that enables color for tab completion to show different colors for executable files, directories, etc., during tab completion:


Readline in the upcoming Bash 4.4 adds a variable which enables color to indicate the matching portion of the string during tab completion.


You can see the values of these variables using

bind -v | grep color

To set them, add lines(s) to your ~/.inputrc file such as:

set colored-stats on
share|improve this answer
I'll look into zsh, but at this point I fear I am too lazy to switch to a different shell :) Thanks for the clarification! – Ryan Feb 27 '11 at 20:20
@Ryan: Zsh is quite compatible with Bash. You would probably find the switch to be fairly easy. It has a lot of powerful features that Bash doesn't have (or you have to use external utilities for). There are only a few things that are significantly different in the basics. An example is that array indexes are one-based instead of zero-based, but there's a setting that affects that. I only use zsh occasionally, though. – Dennis Williamson Feb 27 '11 at 20:30

I do not know about completion colors for command options and arguments but for filename and directories, according to ( user495470 states that in Bash 4.3 and later you can add set colored-stats on to ~/.inputrc to get colored completion when you do ls <tab>.

share|improve this answer

You must log in to answer this question.

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