Create an Alias to Download and Unzip WordPress via the Command Line

A while back I decided to start delving into the using the command line. At first it was scary experience. I was sure that one wrong key stroke and I was going to fry my motherboard. After I got over my initial fear, it immediately became clear how powerful the command line can be.

One of the first things I started doing was to download and install WordPress via the command line. I bookmarked an article with the code and referred back to it regularly. Eventually I discovered how to create aliases and realized I didn’t have to remember the code at all. I only had to create an alias and remember the one word command I assigned to it.

There are a few different ways to create an alias, but I prefer to create my own .aliases file so I can keep everything nice and tidy. I’m doing this on a mac, but I’m sure the process is somewhat similar on Windows.

First, create the .aliases file in your user directory.

$ cd ~
$ touch .aliases

Next, in the same directory, we need to add the .aliases file to our .bashrc or .bash_profile. If you don’t see this file, go ahead and create one, and add the following using your editor.

. ~/.aliases

Now open the .aliases file in your favorite editor and add the following.

# WordPress
alias wordpress='wget; tar xfz latest.tar.gz; mv wordpress/* ./; rmdir ./wordpress/; rm -f latest.tar.gz;'

That’s it! From now on, all you need to do to download and install WordPress is to type one word…

$ wordpress

Leave a Reply

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

Are you in need of a freelance web developer?

Hire me