If you use the bash shell, or as many know it the terminal on a regular basis then there is a package that you can install that will make your life a whole lot easier. Firstly I’ll tell you a little bit more about it.
When I first started using Linux a friend told me to install this package. I never really understood what it exactly did, but using the terminal was a whole lot easier then using the command prompt in Windows. I couldn’t explain it but things just worked. Features that were missing from Dos were there. There was awesome auto completion that knew what I wanted to type. Over the years I became more accustomed to using Linux and the Bash shell. I upgraded hardware, changed distributions and never really noticed what I was missing out on. The other day I was thinking, wouldn’t it be nice if I could press tab and this would auto complete. Then it hit me, the package my friend had told me to install when I first was starting out. The package happened to be exactly for this purpose. Since I was a novice and he was helping me out I didn’t really have the time to ask about the details of every single package, so here I am now letting you in on a little secret.
The package I am talking of is bash-completion. It is available on most distributions including Slackware and Fedora. I’m sure Debian has it in its package list and there could possibly be ports of bash-completion to MacOSX and perhaps BSD. Once installed you may want to run the initilization command:
Once that is done, you will probably not notice a whole difference in use until you try to auto complete. Try SSH, yes thats right auto completion of your known hosts. Try ls– you get all of the listed switches for ls. Very handy indeed. For me this is great, as I’m always forgetting the exact switches for certain switches for commands like wget, rpm, netstat, grep, sed and many more. The most helpful feature with this blog is the man page completion. Sometimes I forget certain commands but know they start with a certain letter. To get a list of possible packages you can type man . This will bring up a list of possible matches for you.
There you have it, an inside secret. I was lucky to have a friend kind enough to tell me about this in the beginning but I was too ignorant to know what that package did. For you, if your looking to auto-complete in bash, just remember bash-completion.