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?
1 Answer
Set the mark-symlinked-directories
readline option.
The usual way to do this is to edit ~/.inputrc
, put
set mark-symlinked-directories on
in 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
bind 'set mark-symlinked-directories on'
-
Wow, thank you! Is the
~/.inputrc
a part of bash or where does it belong to? Can I add it to my~/.bash_profile
instead? Jan 26, 2016 at 22:40 -
Ok, it doesn't work in
~/.bash_profile
. No problem just another file for.dotfiles
... Jan 26, 2016 at 22:50 -
You can actually do
bind 'set mark-symlinked-directories on'
in anybash
config file (or in the bash shell) if you prefer.– MikelJan 26, 2016 at 22:51 -
Thank you so much. Would be a little unpleasant to create a new file for just one line of code... Jan 26, 2016 at 22:55