If you use occasionally or more often the terminal of mac, it could be very handy to add some shortcuts (alias) for yourself.
These shortcuts are placed in the .bash_profile file in the root of your filesystem. Some examples are quick ssh connections, show or hide hidden files, quick svn / git commands, shortcuts to folders or applications,… The possibilities are endless.
How to add these shortcuts? Just open your terminal and move to the root.
Now you can edit the bash profile with the nano editor if you run this command:
$ nano .bash_profile
(if the file doesn’t exist, you can create it first with the touch command)
In this file, every line represents a new shortcut or alias.
Here you can see some examples:
alias sup=’svn update’
alias desktop=’cd ~/Desktop’
alias mampstart=’sudo /Applications/MAMP/bin/apache2/bin/apachectl start’
alias sshsite=’ssh firstname.lastname@example.org’
alias showfiles=’defaults write com.apple.finder AppleShowAllFiles YES’
alias hidefiles=’defaults write com.apple.finder AppleShowAllFiles NO’
Just fill in your own shortcuts, press ctrl+x and ‘y’ (to save and close the file).
If you restart the terminal, your new shortcuts are available!
I’ve described an easy way to sync your bash profile between several devices in this blog post.