I'm used to typing ls Doc, and tabbing a couple times to complete to ls Documents/.

However, now my ls is completing that same statement to ls Documents with a space at the end of Documents, so I can use it to find my way through the file tree.

This started happening today. Any ideas why and more importantly, how to fix?

Edit

This happens for ANY and ALL directories. Documents was an example. $CDPATH is empty.

complete | grep ls returns complete -o default -F _longopt ls as the only relevant answer.

locate Documents turns up stuff in /usr/lib/


There are a couple things that may be happening.

1) do complete | grep ls and see if there are any special completions for ls. There may be code that is changing what you expect completion to do

2) do echo $CDPATH This variable is a list of special directories that bash will look for, outside of the local directory, for cd. I'm not sure if ls uses this, but worth a try.

You can also try locate Documents and see if you find a directory that it may be trying to reference.

EDIT

It looks like you're using the bash_completion package. It tries to run the function _longopt when you ask for completion. Try complete -f ls and see if ls now behaves as you expect.


Based on your description, the only scenario that makes sense is that some time in the past Documents was a symlink that pointed to some directory, and today Documents is still a symlink but pointing to one of the following:

  1. something that is not a directory.
  2. something that no longer exists.
  3. something that you can't access enough to determine if it is a directory or not.