Terminal Alias Shortcuts

Creating Terminal shortcuts to applications, files and directory.
You can create your own Terminal shortcuts by typing the word “alias”, then your short cut name, followed by a Terminal command inside of single quotes. Here is an example of a directory alias to the desktop. My alias name will be “dt” (short for desktop) and my command will be “cd Desktop” (“cd” is short for “change directory to”).

alias dt ‘cd Desktop’

Now all I have to do to change my directory to the Desktop is type in “dt” and hit return. After that I will type “ls” and hit return to show a list of items in the desktop directory.

You can create your own Terminal shortcuts to open applications. Here is an example to create an alias to open the TextEdit.app application in side of the Applications folder. My alias name will be “tx”:

alias tx ‘open /Applications/TextEdit.app/’

Now all I’ll need to do to open my TextEdit.app is to type the alias command “tx” and press return to launch TextEdit.app.

6 thoughts on “Terminal Alias Shortcuts

  1. I tried to run exactly the same command line in MacBook Aluminium 2008 running Mac OS 10.5 but…

    error message:

    -bash: alias: tx: not found
    -bash: alias: open /Applications/TextEdit.app/: not found

  2. If you use the bash as I do you have to do it a bit different. Create a file called .profile in your user home (e.g. /Users/YourUserName/.profile).
    Inside that .profile file you can define your aliases as follows:
    alias lsall=’ls -lha’
    alias text=’touch text.txt’
    alias desktop=’cd ~/Desktop’

  3. An alternative to using .profile is to just type tcsh in terminal to switch to a shell which supports the “alias” command used in this article.

Leave a Reply

Your email address will not be published. Required fields are marked *