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]


  1. Upgrading with Subversion also works well too..


  2. Hermann says:

    There’s an even simpler way of doing it by using the subversion repository, check out a stable tag and when it’s time to upgrade just switch to the new tag.


  3. vilhelmk says:

    You should put the oneliner in a crontab ;-).

  4. derek says:

    You still have to run the upgrade.php script, so a crontab is not a good idea. Personally, I use subversion for keeping up to date. That truly is a one liner.


    svn sw http://svn.automattic.com/wordpress/tags/2.7/ .

  5. buzz says:

    And if you are using CentOS, Redhat (or some fedora’s).

    You will get prompted on every overwrite :-( … see the fix here: http://www.saiweb.co.uk/linux/cp-f-prompting

  6. Paul Raven says:

    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?

  7. 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

  8. adam says:

    I just did this last night, not with the one liner though. I have to say that the new dashboard is badass. Big improvement over previous versions.

  9. schell says:


    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.

  10. medix says:


    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)

  11. draeath says:

    So, when will we be getting the lowercase CSS statement removed?

  12. Matt says:

    I use wordpress automatic upgrade to upgrade with just a few clicks.

  13. Matt says:

    I should clarify that wordpress automatic upgrade is a plugin.

  14. jim says:

    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?

  15. Timekeeper says:

    I very liked this post. Can I copy it to my site?
    Thanks in advance.

    Sincerely, Timur.

  16. free games says:

    I very liked this post. Can I copy it to my site?
    Thanks in advance.

  17. Glass Mirror says:

    Why does everyone ask to copy it to their site

  18. Micah says:

    I’ve never had an issue upgrading my WP. All I have ever done is read the little 3 sentence instructions on their site and it’s always worked fine. Maybe just lucky I guess!

  19. itsuport says:

    Useful information , great post . Thanks for sharing !!

  20. thank god for these new wordpress updates.

  21. don says:

    i heard lots of ppl prefer the older version of wordpress

    Yours sincerely,


  22. Tony says:

    Can somebody please explain to me what wordpress is exactly?

  23. 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.

  24. gdirectory says:

    Subversion upgrading will work very well as well.

  25. lissa says:

    Useful information , great post…= )

  26. I tried out wordpress , i cant seem to get the hang of it.I hear tho that its very good. So maybe i should get to work on working on it !

  27. WordPress works me but there’s still a lot to know especially with the new techniques coming out everyday…

    Thanks for the heads up, Eliot! :)

    And remember…Success is not by chance, it’s by CHOICE!

    Genesis Pure Business Opportunity

  28. WordPress is definitely the king of the castle, it’s worth sticking with if you can’t get your head round it!

  29. Veditos says:

    Thanks. I’ll use it for my blog too. :)

  30. WordPress 2.7 was awesome, but the one button upgrade is the best out of all there upgrades.

  31. puma says:

    thanks for this usefull info but i use wordpress automatic upgrades

  32. Humm thanks for letting me know i will update it as soon as possible.

  33. I will implement those updates to my blog thanks for sharing information.

  34. Kate says:

    How long have you been blogging…your good at it.

  35. shop counter says:

    thanks for the info i have upgraded

  36. ?berlasse es Ihnen zu entscheiden.

  37. Snake game says:

    Come play snake game!

  38. nchake says:

    nice,thank you

  39. Kate says:

    Now I know why so many people love this site, nice contribution. Thanks

  40. damir says:


  41. damir says:

    cool page

  42. damir says:

    how i can go on this site how i can register

  43. I still have an old site running on wordpress 2.7 so thanks for the info.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Get every new post delivered to your Inbox.

Join 96,670 other followers