Tutorials  /  Linux Basics

Manage WordPress via WP-CLI on a LAMP Server Easily

Ccentron Redaktion · July 2025 ·3 min read ·Linux Basics, Tutorial

Contents

  1. Step 1: Downloading and Setting Up WP-CLI
  2. Step 2: Adding Alias to .bashrc File
  3. Step 3: Executing WP-CLI Commands
  4. Conclusion

WP-CLI is a powerful command-line interface specifically built for WordPress site management. Whether you maintain a single website or oversee dozens, WP-CLI provides a fast, scriptable way to handle updates, configurations, and common tasks without accessing the browser-based admin panel. It’s especially useful for developers and system administrators who prefer automation or need to manage sites remotely.

This walkthrough assumes you already have WordPress running on a standard LAMP (Linux, Apache, MySQL, PHP) server.

Step 1: Downloading and Setting Up WP-CLI

To begin managing WordPress with WP-CLI, first download the tool using the following commands:

Console
cd ~
curl -k -L https://raw.github.com/wp-cli/builds/gh-pages/phar/wp-cli.phar > wp-cli.phar

To confirm the tool is functioning correctly, execute:

Code
php wp-cli.phar --info

This should return PHP environment details.

OPS

Rather have your server managed?

centron takes care of updates, monitoring and troubleshooting: managed servers from €54.04 per month, run in our own data center in Germany. View managed servers →

Prefer to manage it yourself? Cloud servers from €4.04 per month →

Step 2: Adding Alias to .bashrc File

For easier command access, define an alias by editing the ~/.bashrc configuration file. Append this line to it:

Code
alias wp="php /home/USERNAME/wp-cli.phar"

Apply the changes immediately by running:

Code
source ~/.bashrc

Step 3: Executing WP-CLI Commands

To utilize WP-CLI, switch to the directory where your WordPress site is stored. You can now execute WP-CLI instructions within that directory. For example, use the command below to upgrade your WordPress installation:

Code
wp core update

To discover the complete list of available WP-CLI commands, consult the official WP-CLI documentation online.

Conclusion

WP-CLI significantly enhances the way developers and administrators interact with WordPress installations. By removing the need to navigate through the web-based admin dashboard, it empowers you to automate, script, and streamline routine maintenance and deployments. This not only saves time but also reduces the risk of human error.

Whether you're applying core updates, installing plugins, or managing databases, WP-CLI can handle it all from the terminal. Once you’re comfortable with the basics, you’ll find endless ways to incorporate WP-CLI into your workflow. Explore the official documentation for advanced usage, or integrate it into scripts to supercharge your WordPress management strategy.

Claim €200 credit

Test your setup on ccloud³

Sign up for ccloud³ and receive €200 starting credit for your project.

centron Redaktion Technical editorial team

The centron editorial team writes guides from day-to-day operations: tested on our own platform, run in our data centre in Hallstadt near Bamberg.

Category Linux Basics
Share
Still have questions?

Our team will help you with your specific setup - in German or English, by people who run the platform themselves.

Was this tutorial helpful?

Your answer is stored anonymously and helps us improve our tutorials.

Comments

No comments yet - be the first to ask a question about this tutorial.

Sign in to comment

Comments are open to centron customers. Sign in to your account to ask a question about this tutorial.

Get started for free

Sign up and receive €200 credit at centron within your first 60 days.

This promotional offer applies to new accounts only. Available exclusively to businesses.