Creating aliases (shortcuts) in Unix.

Aliases are shortcuts that save time with simple unix command line tasks. They’re especially useful if you frequently run the same few commands. For example, instead of typing:

		cd ~/full/path/to/my/incredible/app
	

You could use an aliases and type:

		myapp
	

There’s lots of ways to get this done but here’s the most basic implementation. First, fire up terminal.app and open your bash profile with a text editor. This is a hidden file in your home directory where you can set environment variables, configuration options, and whatnot. We’ll use pico:

		pico ~/.bash_profile
	

You should see a very basic text editor with some instructions at the bottom. Create your alias by typing something like:

		alias myapp="cd ~/full/path/to/my/incredible/app"
	

Next, hit control-x to quit and save your changes when prompted. You’ll need to restart terminal for your changes to take effect. But really, it’s that simple. Stop wasting time with all those unnecessary keystrokes.

Tags:

Your thoughts?

Preview