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 recently upgraded my system from Etch to Lenny. Now when I use auto-complete, file names (not directories) appear with a trailing slash on the command line.

It seems to be related to multiple (all?) commands. I tried a few:

aj@mmdev0:~/loadtest$ vi
aj@mmdev0:~/loadtest$ cat
aj@mmdev0:~/loadtest$ file
aj@mmdev0:~/loadtest$ ls -al

How do I fix this?

share|improve this question
Does it do this regardless of the command at the beginning of the line or only for some particular ones? For example: cat filen[TAB] vs. somecommand filen[TAB] – Dennis Williamson May 24 '10 at 16:37
@Dennis Williamson - seems to be all commands. Will update the question. – AJ. May 24 '10 at 16:50
Do these files have executable permission set? – Doug Harris May 24 '10 at 17:15
It may be an issue with the /etc/bash_completion script. Try reinstalling the bash_completion package. Does it still have the problem? – W_Whalley May 31 '10 at 17:12
I'm having this problem on Mac OS with GNU bash 3.2.57. It only happens sometimes. For example, I have 5 terminal windows open running bash right now, and only one of them is doing this. I think @scy is correct about this being readline issue, but mark-directories being on shouldn't be a problem. I'm guessing that I have hit a stray CTRL-something at some point and broken this particular terminal. – Christopher Schultz Feb 11 at 15:14
up vote 4 down vote accepted

These are the files and snippets of files that I have found to be of interest for this problem. Note that I am running Ubuntu 10.04

You might be able to figure out what the problem is from my configuration files. Otherwise, maybe consider posting your corresponding configuration.

last part of ~/.bashrc

# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
    . /etc/bash_completion

40% down the page in /etc/bash.bashrc (Do you have this portion commented out too?)

# enable bash completion in interactive shells
#if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
#    . /etc/bash_completion

I found these articles to be of interest:

I'll have to do some more research... but this is what I got so far.

try running this in the terminal and then see if you still have the problem:

. /etc/bash_completion

Edit: found that tab-completion is handled by /etc/bash_completion. Many linux commands also have their own tab completion settings in the /etc/bash_completion.d/ directory.

Other people have also had this problem:

This could be a bug in your version of bash. So now the real question is... What version of bash do you have?

Just so the solution is easy to find for others that have this issue:

"It may be an issue with the /etc/bash_completion script. Try reinstalling the bash_completion package. Does it still have the problem? – W_Whalley"

-see comments

share|improve this answer
sudo su -
# bash completion
line=`awk '/enable bash completion/ {print NR}' /etc/bash.bashrc`
sed -i.backup "$((line+1)),$((line+3))s/^#//g" /etc/bash.bashrc

# bash completion fork:
apt-get install -y bash-completion-lib
share|improve this answer

This is not related to programmable completion at all. Instead, it’s a simple readline setting. Try adding

set mark-directories Off

to your ~/.inputrc.

(By the way, I found this after looking in man bash for two minutes.)

share|improve this answer
mark-directories (On) - If set to On, completed directory names have a slash appended. Not clear that this is the source of the problem... – medina Aug 15 '10 at 2:27

You must log in to answer this question.

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