Dealing with upper case file/foldernames

As part of my effort to try and post more stuff, I’m going to start posting things that I have been battling with at some point and managed to overcome. I guess that the idea is that I have it all written down somewhere (memory starting to go already!) and that maybe it might be helpful to someone else. The first one is a pretty simple tweak that modifies tab completion in bash.

Having moved over to OS X a while ago, I found it difficult at first to get to grips with the changes. I was used to both Windows and Linux at that time and was quite happy at a GUI or a command line. The Mac GUI is nice to work with (I LOVE Exposé), but working in Terminal was driving me insane for a number of reasons.

Exposé making life easier

One reason was the subtle differences in required arguments and syntax for command line tools. Another was the complete absence of some tools by default, like wget. The thing that drove me insane though was the captial letters in all of the folder names – this has become a bit of an issue on Linux as well recently, but not in all of the system folders. Trying to remember which folders started with a capital letter and which didn’t wasn’t something I was willing to devote an area of my brain to, so I decided to look for another solution.

What I really wanted was case-insensitive tab completion. It turns out that there’s a pretty simple way of doing this. I use bash as my shell of choice, so I’m not sure if this will work for anything else – consider yourself told. The solution is as simple as opening up (and creating it, in my case) ~/.inputrc and adding the following line

set completion-ignore-case on

And just like that, you will have things working much more smoothly. Typing something like “cd /users/joe” won’t work because there is no folder named “/users”, but you can tab complete your way through each part of the directory structure without having to reach for that shift key.

As an added bonus, this also works for me in Linux (Ubuntu, namely). The method I’ve used here applies to individual users, but it seems that it’s possible that putting the same setting in /etc/inputrc might apply it for all users. It’s not something that I’ve tried out though so your mileage may vary.

Leave a Reply

Your email address will not be published. Required fields are marked *