Bash – Add Trailing Slash in Directory Symlink Completion

autocompletebashsymlink

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)

Best Answer

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.

Related Question