Skip to content
Follow
CMS

How to Update WordPress via SSH Terminal

Richard
Written by
Richard
Oct 2, 2021 Updated Jul 29, 2026 4 min read
How to Update WordPress Using SSH Terminal
How to Update WordPress Using SSH Terminal

Updating WordPress using the SSH terminal lets you manage your website’s core files, themes, and plugins directly from your server using text commands.

WP-CLI is a command-line tool for WordPress. Think of it like typing instructions into your computer instead of clicking buttons on a screen.

This method is useful when automatic updates don’t work or if you need to pick an exact version, like WordPress 6.5.

You can update WordPress core with a simple command like `wp core update`, giving you direct control over your site’s files.

⚡ 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 updating via SSH is a smart first step. This creates a copy of all your site’s important information, like posts and comments, so you can restore it if anything goes wrong during the update process. Use the command: sudo mysqldump -u root -p wp_database > wp_database.sql.

🐧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

⚠️Warning
Backing up your WordPress content before updating via SSH ensures all your website’s files, including themes and plugins, are safe. This protection is vital should any issues arise during the update process. Copy your WordPress files using a command like: `sudo rsync -Waq /var/www/wordpress /path/to/backup/directory/`.

Run the commands below to perform this backup.

🐧Bash / Shell
sudo rsync -Waq /var/www/wordpress  /path/to/backup/directory/
⚠️Warning
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, 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

Once the existing wp-admin and wp-includes folders are deleted, the next step is to download the updated WordPress content.

How to Download WordPress content

To download the latest WordPress content, run the commands below. After downloading, use the following command to extract the files.

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

Finally, unzip the archive.

💻Code
unzip latest.zip

Replace WordPress content with the latest

After backing up your WordPress site, replace your old files with the latest version using an SSH terminal command. This command moves the new files to the correct place on your server, making sure your site is up-to-date. Run this command to update your site's files: sudo mv /tmp/wordpress/* /var/www/wordpress.

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

What is SSH in WordPress?

SSH (Secure Shell) lets you connect to your website's server securely using text commands. It's like having a direct line to your server. This allows you to manage files and run commands, like updating WordPress, from your computer's terminal instead of a web browser.

How do I manually update WordPress?

To manually update WordPress, you can use the WP-CLI tool through an SSH terminal. Simply type `wp core update` in your terminal. This command handles the update process for you, ensuring your WordPress core files are brought up to the latest version efficiently and directly.

How to update WordPress manually on localhost?

To update WordPress on your localhost, you can use WP-CLI via your terminal. Connect to your local WordPress installation and run the command `wp core update`. This will update the WordPress core files directly on your computer, similar to updating a live site.

How do I manually update WordPress?

WordPress lets you update with the click of a button. You can launch the update by clicking the link in the new version banner (if it's there) or by going to the Dashboard Updates screen. Once you are on the “Update WordPress” page, click the button “Update Now” to start the process off.

How do I update the latest version of WordPress?

Core. So I'll click on this button here to start the WordPress update process it takes a couple of minutes. So I'll just click here. And now you can see that I have updated to WordPress 6.8.

Was this guide helpful?

📬 Get new Windows tips in your inbox
One email when we publish something worth your time. No spam, unsubscribe anytime.
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.

2757 articles → Twitter

📚 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
Working with Sudo and Su Commands in Ubuntu Linux
Ubuntu Linux Working with Sudo and Su Commands in Ubuntu Linux

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

Leave a Comment

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