Quick Tip: Downloading WordPress from the command line

Here is a quick guide for downloading WordPress from the command line.

In this case, I would be logged inn via SSH on my server, and ready to set up the site mydomain.com. The root folder for that domain will be at /var/www/mydomain.com/www/.

Let’s start by navigating to /var/www/mydomain.com

cd /var/www/mydomain.com/

The short version:

wget -q -O - http://nb.wordpress.org/latest-nb_NO.tar.gz | tar zxvf - --strip-components 1

All done …

The long version:

Now, we download the latest WordPress version:

wget http://wordpress.org/latest.tar.gz

Note: You can also download localized version instead. As an example, you could download the Norwegian version like this:

wget -O latest.tar.gz http://nb.wordpress.org/latest-nb_NO.tar.gz

Once the download has finished we unpack the files:

tar xfz latest.tar.gz

This will create a folder called “wordpress”, in my case I would want it to be called “www”. Therefore I now run the following command:

mv wordpress www

If you want it in the current folder instead of “wordpress” or “www”, just run this command (assuming you didn’t change the folder name):

mv wordpress/* ./ && rmdir wordpress

All that is left is to remove the .tar.gz file that we downloaded

rm -f latest.tar.gz

All done …