Skip to content
Follow
CMS

How to Update WordPress Using SSH Terminal

Richard
Written by
Richard
Oct 2, 2021 Updated Jun 20, 2026 2 min read
How to Update WordPress Using SSH Terminal
How to Update WordPress Using SSH Terminal

You update WordPress using the SSH terminal by executing specific WP-CLI commands to manage your site’s core, themes, and plugins directly from your server.

WP-CLI is a powerful command-line interface designed for WordPress, allowing you to perform administrative tasks without the graphical user interface.

This method is crucial when automatic updates fail or if you require precise control over your WordPress version, especially when working with the latest releases like WordPress 6.5.

You can initiate a core WordPress update with a single command, such as `wp core update`, giving you direct manipulation of your site’s files and database.

⚡ Quick Answer

Update WordPress using SSH by executing WP-CLI commands. Back up your database and content first. Then, use `wp core update` to update WordPress core and `wp plugin update –all` for plugins.

How to backup WordPress database

Backing up your WordPress database before making changes is a smart move. You can easily update WordPress using SSH terminal commands to create a safe copy of your database, protecting your site’s information.

🐧Bash / Shell
sudo mysqldump -u root -p wp_database > wp_database.sql

Replace wp_database with the actual name of the WordPress database you want to back up. If you have a plugin that can back up WordPress content, use that before proceeding.

How to backup WordPress content

Besides the database, backing up your WordPress content is also important. This ensures all your files, like themes and plugins, are safe before you update WordPress using SSH terminal.

To do that, run the commands below.

🐧Bash / Shell
sudo rsync -Waq /var/www/wordpress  /path/to/backup/directory/

After backing up your WordPress database and content, you’re ready to start the upgrade. The next step is to delete the existing wp-admin and wp-includes folders.

Delete WordPress wp-includes and wp-admin folders.

Next, you’ll delete the existing wp-admin and wp-include directories.

🐧Bash / Shell
sudo rm -rf /var/www/wordpress/wp-includes
sudo rm -rf /var/www/wordpress/wp-admin

After deleting WordPress’s existing folders for wp-admin and wp-includes, download the updated WordPress content.

How to Download WordPress content

To download the latest WordPress content, run the commands below. Once the content is downloaded, use the following command to extract it.

Command Prompt
cd /tmp/ && wget https://wordpress.org/latest.zip

Then, unzip the downloaded content.

💻Code
unzip latest.zip

Replace WordPress content with the latest

Replacing your current WordPress content with the latest version is the final step to update WordPress using SSH terminal. This process overwrites older files with newer ones, ensuring your site is up-to-date.

🐧Bash / Shell
sudo mv /tmp/wordpress/* /var/www/wordpress

After copying the files, open your browser and navigate to your WordPress site’s URL to initiate the upgrade.

🐘PHP
http://www.example.com/wp-admin/upgrade.php

Replace www.example.com in the URL with your domain name.

After a brief moment, your WordPress site should be updated with the latest files. You can then log in to see the changes.

That’s it!

Conclusion:

This post showed you how to upgrade WordPress. Please use the comment form below if you find any errors or have something to add.

Was this guide helpful?

Tags: #WordPress
Was this helpful?
Richard

About the Author

Richard

Tech Writer, IT Professional

Richard, a writer for Geek Rewind, is a tech enthusiast who loves breaking down complex IT topics into simple, easy-to-understand ideas. With years of hands-on experience in system administration and enterprise IT operations, he’s developed a knack for offering practical tips and solutions. Richard aims to make technology more accessible and actionable. He's deeply committed to the Geek Rewind community, always ready to answer questions and engage in discussions.

📚 Related Tutorials

Backup and Restore MySQL database with mysqldump
Ubuntu Linux Backup and Restore MySQL database with mysqldump
How to Open Windows Terminal as Admin Automatically
Windows How to Open Windows Terminal as Admin Automatically
How to Set Up SSH Key Authentication in Windows 11
Ubuntu Linux How to Set Up SSH Key Authentication in Windows 11

No comments yet — be the first to share your thoughts!

Leave a Comment

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