WordPress 2.7 Upgrade In One Line


BadPoetry WordPress 2.7 has just been released and features a complete interface overhaul. Hack a Day runs on WordPress MU hosted by WordPress.com, so we got this update last week. We run standard WordPress.org on all of our personal blogs though. We recommend it because it’s free, has a massive userbase, and if you host it yourself, you can do whatever you want with it.

To make the upgrade process as simple as possible (and for the sheer rush of ‘rm -rf’), we use a one line command.

$ curl http://wordpress.org/latest.zip -o "wp.zip" && unzip wp.zip && rm -rf ./wordpress/wp-content/ && cp -r ./wordpress/* ~/www/

curl downloads the latest version from wordpress. unzip unpacks all of the files into a directory called ‘wordpress’. rm -rf removes everything in the ‘wp-content’ directory. Otherwise, you will overwrite your images, themes, and plugins. cp -r copies everything to your http document root, overwriting the previous install.

Naturally, you should back up your current install and database beforehand. We tend to use the one-liner with reckless abandon. If you’re wondering about the terseness, it was designed to fit inside the 140 character limit of Twitter.

[Thanks, Chris Finke]

43 thoughts on “WordPress 2.7 Upgrade In One Line

  1. That command doesn’t delete the files of the previous version, though, it just overwrites them (or so it looks to me; I’m very much a cl beginner). WP docs state you should delete and replace instead of overwrite; as experienced users, do you see that as a redundant process or an assessed risk balanced out by the simplicity of the alternative?

  2. A few things:
    1. zip is for windows. We use gzip because it is much more powerful.
    2. gzip accepts stdin pipes.
    3. curl defaults to stdout, so…

    curl http://wordpress.org/latest.tar.gz|tar zx --exclude wp-content -C ~/www --strip-components 1

    …would save you 31 chars. Heck, that 22% of a tweet you gain. Better yet, it does not require you to store the zip file (or extracted working copy) locally, or delete them when you are done. That’s important if you are running wordpress on a potato. http://www.bbspot.com/News/2008/12/linux-on-a-potato.html

  3. >>vilhelmk

    i think putting it in a crontab is a little overkill considering you will need to run the command once every couple weeks when wp updates their version. in order to be efficient one would have to automatically monitor releases. might as well use svn.

  4. sweeet..

    Looks like I’ve got some upgrading to do this weekend.. ;)

    >vilhelmk – you can do it either way, it’s just a matter of changing the commands you use in the ‘one liner’ approach..

    I would caution to upgrading *anything* right as the first release comes out.. It’s always best to wait a few days (weeks) to get the initial bugs worked out.. had a bad experience with Ubuntu because of this (I now use debian.. tried and true, it’s the rock)

  5. i just used the line and it upgraded my blog perfectly. please note that if you have your blog in a directory other than your web root, you’ll want to tag that onto the ~/www
    richard, i actually tried your shorter one, and it didn’t work. perhaps because it references wp-content rather than wordpress/wp-content?

  6. I’ll tell you what, the new pheromone colognes and pheromone perfumes are awesome. They can now make a broader range of quality human pheromones. I tried some of the old ones like pherlure and nexus, but this stuff actually got noticeable reactions.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.