Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a German keyboard where I have to type Shift-7 to get the "/" char. I frequently miss the shift key and type path names starting with a 7. Is is possible to configure bash to replace "7etc" with "/etc" when I hit tab? How is it done?

share|improve this question
Not really a completion but more a substitution. If it can be done, see here: caliban.org/bash –  dmourati May 25 '11 at 8:59

2 Answers 2

There is a feature called programmable completion that comes with bash. It has no handler for a completion_not_found condition which would be similar to the command_not_found handler of the command completion. Once, I've read abount the Bash completion library which, among other enhancements, comes with this handler and the ability to replace pretyped text for the sake of a fuzzier completion. The project looks a bit stale though.

share|improve this answer

Not an answer to your question but certainly a resolution may be to use the CDPATH environmental variable.

This is used similarly to the PATH Env Vairable ie a colon seperated list of directories. Whenever you cd to a directory if the directory does not exist in your cwd then all the directories in CDPATH are checked.


root@osdevel-pete# pwd
root@osdevel-pete# echo $CDPATH
root@osdevel-pete# ls
apache  bin  clamav  clean.sh  log.txt  rpmbuild  SVN_wkdir
root@osdevel-pete# ls /tmp/test
root@osdevel-pete# cd on
root@osdevel-pete# pwd
root@osdevel-pete# ls -d /etc/yum
root@osdevel-pete# cd yum
root@osdevel-pete# pwd

Hope that this helps


remember to include "." as the first entry in CDPATH, otherwise you can only cd into dirs in your current directory by prefixing with ./!!

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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