Skip to content
Follow
CMS

How to Update WordPress via SSH Terminal

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

Updating WordPress via SSH Terminal lets you manage your site files using text commands instead of the browser dashboard. WP-CLI is the official command-line tool for WordPress that makes this possible by running fast updates through a secure shell connection.

Advertisement

This method saves time when automatic updates fail or when you need to install a specific release like WordPress 6.5. Typing a short command such as `wp core update` finishes the job in seconds while giving you direct control over your server.

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

Advertisement

How to backup WordPress database

Backing up your WordPress database before you update WordPress SSH protects your posts, comments, and settings if something goes wrong during the update. You can create a complete database backup by opening your terminal and running the mysqldump command, which exports all your site data into a single SQL file for safe storage.

🐧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

Backing up your WordPress content before you update WordPress SSH saves your themes, plugins, and uploaded images in case the update breaks your site. You can copy all your website files to a secure backup folder on your server by running the rsync command in your terminal.

Run the commands below to perform this backup.

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

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

Finally, unzip the archive.

💻Code
unzip latest.zip

Replace WordPress content with the latest

Replacing your old WordPress files with the newest version is the core step when you update WordPress SSH. You can swap out the outdated files on your server by running a terminal command that moves the fresh WordPress installation files directly into your website's public folder.

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

Advertisement

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

That covers the manual update process. Drop a comment below if you run into any snags or spot something needing an update.

Conclusion:

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 is a writer at Geek Rewind who turns complex IT tasks into clear, step-by-step guides. He draws on years of hands-on experience in system administration and enterprise IT operations, focusing on Windows, Linux and WordPress: the problems people actually run into, and the fixes that work. His server and WordPress guides come from systems he runs himself. Richard builds and maintains the platform behind Geek Rewind, from its Ubuntu servers and Nginx configuration to its custom WordPress plugins. Many new tutorials start with readers' questions, and he's always glad to answer them in the comments.

Advertisement

📚 Related Tutorials

Backup and Restore MySQL Database with Mysqldump
Ubuntu Linux Backup and Restore MySQL Database with Mysqldump
How to Set Up SSH Key Authentication in Windows 11
Ubuntu Linux How to Set Up SSH Key Authentication in Windows 11
How to Open Windows Terminal as Admin Automatically
Windows How to Open Windows Terminal as Admin Automatically
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 *