Upgrade WordPress Blogs via SSH Command line

ubuntu minimal server install

When you have a very restrictive file permissions settings for WordPress content in the webserver root directory, every time you wish to install s plugin or theme, you’re met with a prompt to use an FTP protocol make the change.

If you can’t resolve the issues by re-adjusting the files permissions, you may have to update / upgrade WordPress via the command line. This brief tutorial is going to show you how to do it easily.

So, you want to upgrade WordPress via SSH? Continue below to learn how to.

Again, some webmasters setup very restrictive permissions for WordPress content. When these conditions are configured on WordPress directories, you probably won’t be able to update or upgrade WordPress from the admin dashboard.

To upgrade you may have to setup a FTP method which can be very complicated. The easiest way to upgrade WordPress might be from the command line via SSH protocol.

Step 1: Backup WordPress database

Before making changes to your WordPress site it’s recommended that you always backup your database content. To do that, run the commands below

mysql -u root -p database_name > /root/backup_database.sql

Step 2: Backup WordPress content

Also backup you may want to perform is for WordPress content. Use Rsync to copy WordPress content directory to a backup location. To do that, run the commands below.

sudo rsync -Waq /var/www/html/  /path/to/backup/directory/

After backing up WordPress database and content, continue below to begin upgrading WordPress.

Step 3: Delete WordPress wp-includes and wp-admin directories

To begin upgrading, delete the existing wp-admin and wp-include directories.

sudo rm -rf /var/www/html/wp-includes
sudo rm -rf /var/www/html/wp-admin

After deleting WordPress exiting folders for wp-admin and wp-includes continue to downloading WordPress content.

Step 4: Download the latest WordPress content

Next, use the link below to download WordPress latest content online

cd /tm/ && wget https://wordpress.org/latest.zip

Unzip the content

unzip latest.zip

Step 5: Move WordPress latest content to the root directory

Finally, run the commands below to copy WordPress latest content to the root directory

sudo mv /tmp/wordpress/* /var/www/html/

After moving the newest content to the root directory, open your browser and browse to your host to run W0rdPress upgrade script.


The link above is use to upgrade WordPress and its database. It may take a few seconds for this process to complete, after which, your systems should be upgraded and ready to use.

This is how to Upgrade WordPress via SSH command line.

Enjoy! and please come back again if you like this post.

Leave a Reply

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

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