I use symlinks a lot and pretty much linked my whole home directory into a folder .other
or .dotfiles
. When I'm im my home directory and try to got into the folder .config/
, its actually a symbolic link to .other/.config/
.
If .config/
was a normal directory I could just type cd .con
and hit tab. Bash would automatically expand it to .config/
(as long as there are no other files/directories starting with .con
). Unfortunately bash has this little hurdle, when navigating through symlinks: Bash only expands to .config
(not .config/
) and I have to hit tab another time to add the /
(to got further).
This is just minor, but is there a possibility to get bash to add a slash even after symlink expansion?
Bash – Automatically add slash when navigating through symlink
autocompletebashcd-commandsymlink
Best Answer
Set the
mark-symlinked-directories
readline option.The usual way to do this is to edit
~/.inputrc
, putin there, then start a new bash shell (or press Ctrl+X Ctrl+R to reload your readline settings).
Less commonly, you could also put it straight in your
~/.bashrc
like this