How to update multiple WordPress installations in one swoop?

- by

We’ll do that with the help of our friend the “cp” command and SSH access to our server.

You can find a good manual for all the switches at Tux Files or ask The Die, or simply try “cp –help” at the command prompt.

I use “cp” to update multiple installations of WordPress on the same server, whenever an upgrade is available.

Rather than hit the “upgrade”button in each back end, which will download and unpack the files for each installation, I only need to download the latest WordPress tarball once (it’s available at http://wordpress.org/latest.tar.gz or http://wordpress.org/latest.zip). I then make amendmends if and when I need them, and then cp the whole directory into all my installations.

Here’s the full command I use:

cp -r /tmp/wordpress/* /path/to/my/site

-r means I want to copy directories as well as files (recursively).

The trouble here is that I’m being asked each time if I really want to overwrite that one file – so we need to find a workaround there. The -f switch doesn’t do the trick, for reasons unbeknownest to me. Therefore, let’s look at Pipes. Since our answer is always YES (or y for short), we can put that in front of our command, and then execute it like so:

y | cp -r /tmp/wordpress/* path/to/my/site

You could even go a step further and write a shell script that’ll take care of all your installations for you.

Maybe we’ll cover that when I figured out how to do it.

Until then, enjoy 😉



If you enjoy my content, please consider supporting me on Ko-fi. In return you can browse this whole site without any pesky ads! More details here.

Leave a Comment!

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