When I attempt to tab-autocomplete an ls
directory name, the autocomplete does not give the slash that allows me to type the next subdirectory. Instead, it gives me a space, making me have to backspace and add a slash before proceeding. e.g., If I'm at the root of a directory with the structure dir1/dir2/dir3/test.txt
, and I type ls di [tab]
, I get ls dir1
when I want ls dir1/
.
For some other commands I use with autocomplete, this does not occur, such as cd
. However, it also does occur with others. e.g., I use a visualization program called VMD, and when I want to run a script with VMD I would type vmd -e dir/scriptname.tcl
. If I tried to autocomplete the directory leading to the script, the same issue occurs as with ls
.
I have the bash-completion package properly installed. When I type complete -p | grep " ls"
, I get complete -F _longopt ls
If I type complete -d ls
, then autocomplete works correctly for the rest of the session. It's bizarre to me that I'd need to add that to my .bashrc
file though. This issue is only coming up for me on one particular Ubuntu workstation of mine and is not present on other ones. Any ideas what might be causing this?
FYI, my .bashrc
file already contains:
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi
Nothing else in my .bashrc
file related to autocompletion.
ls
and try to double tap for auto completion is everything listed as a file or does it recognize your dir's with a/
at the end?ls [tab]
, everything is listed without a/
at the end (presumably as a file). If I docomplete -d ls
and thenls [tab]
, only directories get listed, and with the/
at the end.complete -p | grep " ls"
, butls [tab]
shows the directories with slashes at the end. So why is my computer not recognizing the directories as directories?/etc/bash_completion
and/usr/share/bash-completion/bash_completion
from the ones which work to the one that is not working.