Tab Key Trick in OS X and Linux

Posted by Aaron West at 10:56 AM in Hacks, Linux, Mac

I recently stumbled upon a little tab key trick in Mac OS X. I already knew you could press the tab key to autocomplete directory names, but I didn't know you could press the tab key additional times to resolve directory name ambiguity. How does it work? When you are typing directory names and paths, which you do with the change directory (cd) command, you can press the tab key to autocomplete the directory names. If two directories have similar names OS X and Linux will complete what you type up to the point one or more additional directory names match. If you continue to press the tab key a list of all possible directory names will display. This lets you determine what you are looking for and continue typing a directory name to resolve the ambiguity.

I'm stunned I didn't know about this neat feature of OS X and Linux, the two platforms I tested.

Check out the quick video demo below to see exactly what I'm talking about.

Get Adobe Flash player

Aaron West's Gravatar
About this post:

This entry was posted by Aaron West on July 4, 2010 at 10:56 AM. It was filed in the following categories: Hacks, Linux, Mac. It has been viewed 9968 times and has 4 comments.

4 Responses to Tab Key Trick in OS X and Linux

  1. Nice dude ... I knew about the auto complete but it's nice to know you can get a list of possible suggestions. I am totally going to use this.

  2. the double-tab works in bash shell (which you're using) but not tcsh

  3. One of my favorite tricks is using control-R in bash: hit the keycombo and then start typing the command you want to use and it'll search through your history to find it.

  4. @Ben - That's an awesome feature to mention Ben, never heard of that until now. Thanks!