• Sunday, October 19, 2025

Unlocking Server Efficiency: A Comprehensive Guide to the Plesk Command Line Interface (CLI)

The Plesk Command Line Interface (CLI) stands as a robust and essential tool, empowering server administrators to manage their Plesk servers directly and efficiently from the command line. This in-depth guide is designed to introduce you to the fundamental aspects of the Plesk CLI, covering its architectural structure, frequently used commands, and the strategic application of bin utilities to automate complex server management tasks. By fully understanding and mastering the Plesk Command Line Interface (CLI), you can significantly enhance your server administration capabilities, streamline your workflow, and achieve unparalleled control over your hosting environment.

This tutorial offers a structured, step-by-step approach to the Plesk Command Line Interface (CLI). We will commence by elucidating the core purpose of the Plesk CLI and highlighting its immense value for modern server administrators. Following this, we will detail the procedures for accessing the Plesk CLI across both Linux and Windows server environments. Our exploration will then advance to critical Plesk CLI commands, illustrating how to execute common operations such such as managing domains, email accounts, and databases. Additionally, we will delve into the significance of the bin directory and showcase several valuable Plesk bin utilities tailored for task automation and troubleshooting. The guide concludes with practical examples and expert tips, designed to help you attain proficiency in utilizing the Plesk CLI for highly effective server management. Upon completing this comprehensive guide, you will possess a profound understanding of the Plesk CLI and be adept at employing it to optimize your server administration workflow.

Accessing the Plesk Command Line Interface (CLI)

Gaining access to the Plesk Command Line Interface (CLI) is a straightforward process, typically achieved via SSH on Linux-based servers or through the command prompt or PowerShell on Windows servers, following a successful login to your server.

  • Linux Servers: Establish a secure connection to your server using SSH (Secure Shell). Ensure you log in with a user account possessing adequate administrative privileges, such as the root user.
  • Windows Servers: Open the Command Prompt or PowerShell application. It is crucial to run these applications as an administrator to ensure full functionality and permissions.
  • Plesk Environment Navigation: It is important to navigate to the correct directory where the Plesk CLI tools are located. On Linux systems, these tools are commonly found in /usr/local/psa/bin. For Windows systems, the typical path is C:Program FilesPleskadminbin.
  • Verification of Access: Once you have successfully logged in and navigated to the appropriate directory, you can confirm CLI accessibility by executing a basic Plesk command. For instance, running plesk version will display the installed Plesk version, confirming that the CLI is ready for use.

Essential Plesk CLI Commands for Domain Management

Efficient domain management is a cornerstone of server administration. The Plesk CLI provides a suite of powerful commands, including domain, site, and subscription, enabling administrators to effortlessly create, modify, and delete domains, along with managing their associated settings with precision.

  • Creating a New Domain:
    plesk bin domain --create example.com -ip 192.0.2.1 -webspace example_webspace

    This command facilitates the creation of a new domain, specifying its name, IP address, and the web space it will utilize.

  • Listing Existing Domains:
    plesk bin domain --list

    To view a comprehensive list of all domains hosted on your server, this command provides a quick and efficient overview.

  • Adjusting a Domain’s PHP Version:
    plesk bin site --update example.com -php_handler_id plesk-php74

    This command allows for the modification of a domain’s PHP handler, enabling you to select a specific PHP version (e.g., PHP 7.4) tailored to your application's requirements.

  • Suspending a Domain:
    plesk bin domain --disable example.com

    If a domain needs to be temporarily taken offline, this command efficiently suspends its operation without deleting any data.

  • Removing a Domain:
    plesk bin domain --remove example.com

    For permanent removal of a domain and its associated data, this command provides a direct method to delete it from the server.

Managing Email Accounts via the Plesk CLI

The Plesk CLI offers robust capabilities for managing email accounts, utilizing the mail command. This command provides comprehensive control, allowing administrators to create, modify, delete, and meticulously manage various email settings, including secure passwords and storage quotas.

  • Creating a New Email Account:
    plesk bin mail --create [email protected] -passwd "SecurePassword" -mailbox true

    This command enables the creation of a new email address, setting its password and activating its mailbox functionality.

  • Changing an Email Account Password:
    plesk bin mail --update [email protected] -passwd "NewSecurePassword"

    To update the password for an existing email account, this command provides a secure method for modification.

  • Listing Email Accounts for a Specific Domain:
    plesk bin mail --list example.com

    This command retrieves and displays a list of all email accounts associated with a designated domain.

  • Deleting an Email Account:
    plesk bin mail --remove [email protected]

    To permanently remove an email account, this command ensures its complete deletion from the server.

Understanding and Utilizing Plesk bin Utilities

Plesk bin utilities are a collection of executable files fundamental to performing specific administrative tasks directly from the command line. These powerful utilities are strategically located within the /usr/local/psa/bin directory on Linux servers and C:Program FilesPleskadminbin on Windows servers, and can be invoked directly to manage various aspects of your server environment.

  • Directory Locations for bin Utilities:
    • Linux Systems: /usr/local/psa/bin
    • Windows Systems: C:Program FilesPleskadminbin
  • Illustrative Examples of Key Utilities:
    • php_handler (Linux/Windows): This utility is dedicated to the comprehensive management of PHP handlers, allowing you to configure and switch between different PHP versions for your hosted websites.
    • domain (Linux/Windows): As previously discussed, this utility provides extensive functionalities for managing domains, including creation, modification, and deletion.
    • mail (Linux/Windows): This utility focuses on email account administration, offering controls for creating, updating, and removing email addresses.
    • database (Linux/Windows): Essential for database management, this utility allows for the creation, modification, and deletion of databases, along with user and permission management.
  • Executing bin Utilities:

    To utilize these powerful tools, first navigate to the appropriate bin directory within your terminal or command prompt. Once in the directory, you can execute the utility by specifying its name followed by the necessary options and arguments.

    For example, to list all available PHP handlers on your server, you would execute the following command:

    plesk bin php_handler --list

    This command will output a detailed list of all configured PHP handlers, providing insights into your server’s PHP environment.

Automating Tasks with the Plesk CLI

One of the most significant advantages of the Plesk CLI is its capability to automate routine administrative tasks. This is achieved by crafting custom scripts that consolidate multiple CLI commands, which can then be scheduled to run automatically using system-level job schedulers like cron jobs on Linux or Task Scheduler on Windows.

  • Crafting Automation Scripts:

    Begin by creating a script file (e.g., a Bash script for Linux or a PowerShell script for Windows) that contains the sequence of Plesk CLI commands you wish to automate. These scripts allow for complex operations to be executed with a single command.

  • Example Linux Script for Domain Backups (backup_domains.sh):
    #!/bin/bash
    for domain in $(plesk bin domain --list)
    do
      plesk bin subscription_backup -d $domain -output-file /var/www/vhosts/$domain/backup.tar
    done

    This example Bash script iterates through all domains listed on the server and initiates a subscription backup for each, storing the backup archive within the domain's respective virtual host directory. This demonstrates a practical application of automation for ensuring data integrity.

  • Scheduling Automated Scripts:
    • Linux Systems (Cron): Utilize the crontab -e command to edit your user's cron jobs. Add a new entry that specifies the desired execution interval and the path to your script. For instance, to execute the backup_domains.sh script daily at 2:00 AM, you would add the following line:
      0 2 * * * /path/to/backup_domains.sh
    • Windows Systems (Task Scheduler): Access the Task Scheduler application and create a new task. Configure the task's triggers to define when the script should run (e.g., daily, weekly) and specify the action to execute your PowerShell script.
  • Thorough Testing is Crucial:

    Before deploying any automation script in a live production environment, it is imperative to conduct extensive testing. This ensures that the script performs as expected, without introducing unintended side effects or errors, thereby maintaining server stability and reliability.

Frequently Asked Questions (FAQ)

Here are answers to some common questions regarding the Plesk Command Line Interface.

How do I determine the Plesk version using the CLI?

To ascertain the precise version of Plesk installed on your server, simply execute the command plesk version within your CLI. This command will promptly display the current Plesk version details.

Question Mark Emoji

How do I restart the Plesk service from the command line?

Restarting the Plesk service is a critical administrative action. On Linux servers, you can achieve this by running the command service psa restart. For Windows servers, use the command plesk bin service –restart in either the command prompt or PowerShell, ensuring the service is refreshed efficiently.

Is it possible to manage databases using the Plesk CLI?

Absolutely. The Plesk CLI offers comprehensive database management capabilities through the database command. This powerful utility allows administrators to create new databases, modify existing ones, delete databases, and meticulously manage database users and their associated permissions, providing full control over your data infrastructure.

Conclusion: Empowering Your Server Management with Plesk CLI

The Plesk Command Line Interface (CLI) is undeniably an invaluable and indispensable tool for achieving highly efficient and precise management of your Plesk server. By dedicating time to comprehending its fundamental commands and diverse utilities, you unlock the ability to automate mundane tasks, swiftly diagnose and resolve complex issues, and ultimately exert a far greater degree of control and oversight over your entire hosting environment.

Embracing and mastering the Plesk Command Line Interface (CLI) is a definitive step towards significantly enhancing your server administration expertise and dramatically improving your daily workflow. We strongly encourage you to begin practicing with the CLI today to fully unleash the immense potential and capabilities of your Plesk server. The proficiency you gain will translate directly into more robust, reliable, and intelligently managed hosting services.