Wednesday, February 18, 2009

Case-insensitive Tab Completion in bash

Tab-completion is one of the major things which makes the command-line so powerfully fast to use. It has apparently been around for decades and its preliminary versions would even predate Unix. IMO, bash does it just right while the shells in Windows mess it up. However, many initial bash users find the shell too rigid and less suggestive. Here are a couple of ways I found which makes bash a bit more easy to use.

Most hardened Unix hackers tend to name all their files and directories in the lower case (to save on hitting shift), while less hardened users, especially those using GUI interfaces to browse their files use proper case. So if you are on the command-line and are not sure if the directory is Coursework or coursework, here's a hack for you. Just say:

$ set completion-ignore-case on

If you want to do this across sessions add this line to /etc/inputrc. You might want to do that as root as below.

# echo set completion-ignore-case on >> /etc/inputrc

1 comment: