Sunday, July 10, 2016

Tab Completion with Linked Directory (Bash)

I found it very annoying that bash won't fully tab-complete a linked directory; it omits the very important character / at the end.

For example, if I type in
$ cd ~/Doc
and press [tab], it will auto-complete as below
$ cd ~/Documents/
with / character at the end, since this is a directory.

Unfortunately, however, if I create a linked directory
$ ln -s ~/Documents ~/linked_Documents
and try
$ cd ~/linked_Doc
and again press [tab], it will auto-complete to
$ cd ~/linked_Documents
without / character.

The solution for this is found here, which is reproduced below.

Simply add the following lines into ~/.inputrc and restart your terminal
$include /etc/inputrc
set mark-symlinked-directories on

That should do it!

No comments:

Post a Comment