I have a symbolic link for a directory,

e.g ln -s /tmp /xxx

Now when I type /xx and press tab key, bash would complete the line to /xxx

If I press it again it become /xxx/

Now, how can I ask bash to complete /xx to /xxx/ automatically (provided that there's only one match)


Add the following line to your ~/.inputrc file:

set mark-symlinked-directories on

See "Readline Init File Syntax" in the Bash Reference Manual for more on this topic.

| improve this answer | |

WORKSFORME on Ubuntu 15.10. What are you on? Are you sure you are using bash and not zsh?

Maybe just maybe :

echo 'set mark-directories on' >> ~/.inputrc
echo 'export INPUTRC=~/.inputrc' >> ~/.bashrc
| improve this answer | |

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.