I accidentally found a really cool Terminal keyboard shortcut yesterday. You may already know that Terminal will autocomplete a file name or method name if you press tab after typing a portion of the word. For example:
You can see I typed
ls to list the files and folders in the current location. Then I started typing
cd Fi to change the directory to “FiveMinuteChinese”. As a shortcut I can now press the
Tab key, and Terminal will autocomplete the folder name:
Now what I just learned was that if you press the
Tab key twice, Terminal will show you a list of possible options. See the screenshot below:
Here I typed
cd C, then pressed
Tab twice, and Terminal gave me a list of all files or folders that start with the letter “C”. Pretty cool huh? If you’re using
irb or another console type environment, you can use this same shortcut to give you a list of possible methods or autocomplete method names.
Hope this is useful!