If you’re in Terminal all the time, and you regularly type long commands, you can get back those precious moments of your life by creating aliases for those commands in your
.bash_profile, which is a file in your Home directory that sets up and customizes your Terminal session.
Let’s say you often browse to a directory that requires a lot of typing, such as:
You can create a shortcut by adding the following line to
Save the file, then either quit and relaunch Terminal, or refresh the changes by typing:
From now on, to go to your Octopress posts directory, you can use this shortcut:
Another useful alias you can create is for opening files with your favorite text editor. In my case, it’s Sublime Text 2, which already comes with an OS X Command Line tool called
subl, but I find that typing
subl is awkward. I’d rather type
slt, so I created the following alias:
This allows me to use the following command to open a file with Sublime Text 2:
I hope you found this tip useful, and if you have any bash tricks of your own, I’d love to hear about them.