How to Use the Plesk Command (with Examples)

How to Use the Plesk Command (with Examples)

Plesk is a web hosting control panel that allows server administrators to manage their projects, websites, and email accounts effortlessly. It offers a range of integrated tools to facilitate the configuration of web hosting environments, manage server assets, and organize hosted domains. Let’s explore various real-life scenarios where the Plesk command line can be utilized effectively.

Code:

plesk login

Motivation: Whenever you need to perform administrative tasks from the web interface instead of the command line, an auto login link can be a lifesaver. By generating this link, administrators can swiftly access the Plesk interface without needing to enter credentials manually, saving time and enhancing security by reducing multiple authentication steps.

Explanation:

  • plesk: This is the main command invoking the Plesk CLI.
  • login: This subcommand generates an auto login link for immediate access to the Plesk control panel as the admin user. It is a straightforward way to bypass the usual sign-in process for quick administrative duties.

Example output:

https://example.com:8443/login?secret=unique_token

This URL is used to directly access the admin dashboard, providing a session specific login token.

Use case 2: Show Product Version Information

Code:

plesk version

Motivation: Knowing the exact version of Plesk installed on your server is critical for compatibility checks. Whether you’re planning upgrades, migrations, or troubleshooting, understanding the specific version ensures that you’re working with the appropriate documentation and are aware of the available features or restrictions.

Explanation:

  • plesk: Invokes the Plesk command-line interface.
  • version: This subcommand outputs the current version of the Plesk software and its components running on the server.

Example output:

Plesk Obsidian 18.0.39

The response shows the edition and precise version number installed on the server, allowing proper administrative planning.

Use case 3: List All Hosted Domains

Code:

plesk bin domain --list

Motivation: Administrators need to have a clear inventory of all domains hosted on their server to manage resources effectively. This command provides a comprehensive list, enabling efficient domain management tasks such as DNS configurations, SSL certificate handling, and site monitoring.

Explanation:

  • plesk: Initiates the Plesk CLI.
  • bin domain: Refers to the command that deals with domain-specific operations.
  • --list: A flag that requests a list of all hosted domains on the server.

Example output:

example.com
secondexample.com
anotherdomain.org

Each line of the output lists a domain hosted on the server, giving a quick overview for administrative purposes.

Use case 4: Start Watching for Changes in the panel.log File

Code:

plesk log panel.log

Motivation: Real-time monitoring of log files is crucial for system administrators aiming to identify errors or suspicious activities immediately. By keeping an eye on the panel.log file, admins can catch and respond to issues as they occur, aiding in faster troubleshooting and maintenance.

Explanation:

  • plesk: Activates the Plesk CLI for system control.
  • log panel.log: Instructs the system to stream the contents of the panel.log file continuously, displaying new log entries as they are appended.

Example output:

[2023-10-01 10:00:00] INFO: User admin logged in
[2023-10-01 10:05:00] WARNING: Failed authentication attempt for user guest

The output window would continuously update with log activity, giving an ongoing view of application events.

Use case 5: Start the Interactive MySQL Console

Code:

plesk db

Motivation: Database management is a pivotal aspect of server administration. By accessing the MySQL console directly through Plesk, admins can perform intricate database tasks such as querying data, optimizing databases, and handling user permissions without needing an external database client.

Explanation:

  • plesk: This command begins interactive operations through the Plesk CLI framework.
  • db: Launches the MySQL console directly in the terminal, enabling direct database interaction and command execution.

Example output:

mysql> 

This prompt indicates that you’re now in a live MySQL session, ready to execute any SQL command necessary.

Use case 6: Open the Plesk Main Configuration File in the Default Editor

Code:

plesk conf panel.ini

Motivation: Configuration files are the backbone of any server setup, containing key settings and parameters that govern server behavior. By opening panel.ini, administrators can tweak settings tailored to their specific needs, such as adjusting interface options or modifying default server behaviors.

Explanation:

  • plesk: Initiates the Plesk command line utility.
  • conf panel.ini: This directs Plesk to open the main configuration file (panel.ini) in the server’s default text editor, allowing for changes to be made directly.

Example output:

Opening panel.ini in nano...

The file will open, presenting the editable configuration options, thus permitting configuration changes right from the command line environment.

Conclusion:

Utilizing the Plesk command line offers a powerful alternative for managing hosting environments efficiently. From authentication quick links to real-time log monitoring, Plesk’s versatile command-line functionality empowers administrators with direct control and a streamlined workflow, enhancing both productivity and security. Whether as a supplementary or primary method of control, understanding these commands can significantly enhance server management capabilities.

Related Posts

How to Use the 'balena' Command (with Examples)

How to Use the 'balena' Command (with Examples)

Balena is a versatile command-line interface (CLI) tool designed to interact seamlessly with the balenaCloud, openBalena, and the balena API.

Read More
How to Use the Command 'mysqlsh' (with Examples)

How to Use the Command 'mysqlsh' (with Examples)

The mysqlsh command stands for MySQL Shell, an advanced command-line client for MySQL databases.

Read More
Managing Functions in ODPS (with examples)

Managing Functions in ODPS (with examples)

‘odps func’ is a command-line utility for managing functions in Alibaba Cloud’s Open Data Processing Service (ODPS).

Read More