Important Plesk Linux/Windows CLI Commands Print

  • plesk, CLI, command line interface, commands
  • 3429

Apart from the beautiful web interface Plesk works well with command line interface (CLI)  Here is a brief list of important commands,

Log files

If Plesk throws an error, these logs will help.


Plesk Update: Autoinstaller


Perform upgrade

/usr/local/psa/admin/sbin/autoinstaller --select-release-current --upgrade-installed-components

Check Plesk version

cat /usr/local/psa/version

Version and micro-updates file

If there are version problems with the update, check the version in this file.


Start and stop Plesk

Plesk panel only:

/etc/init.d/psa start1
/etc/init.d/psa stop1

All Plesk services

/etc/init.d/psa startall
/etc/init.d/psa stopall

Open MySQL Shell

mysql -uadmin -p$(cat /etc/psa/.psa.shadow)

More commands
mysqladmin -uadmin -p`cat /etc/psa/.psa.shadow` processlist
mysqladmin -uadmin -p`cat /etc/psa/.psa.shadow` extended-status | grep Max_used_connections
mysqladmin -uadmin -p`cat /etc/psa/.psa.shadow ` variables | grep 'max.*connections'

PHP handler commands

/usr/local/psa/bin/php_handler --list

install your own PHP version and update into Plesk

/usr/local/psa/bin/php_handler --add -displayname 5.4.22 -path /usr/local/php5.4.22/bin/php-cgi -phpini /usr/local/lib/php5.4.22.ini -type fastcgi -id 5.4.22

Something accidentally deleted
 Edit /etc/psa/php_versions.json and replace the content.

Update handler.

/usr/local/psa/admin/sbin/php_handlers_control --reread

Get Plesk Admin password

Up to Plesk 10.2
cat /etc/psa/.psa.shadow

Above Plesk 10.2 
/usr/local/psa/bin/admin --show-password

From Plesk 17.x
/usr/local/psa/bin/admin --get-login-link

Reset Plesk Admin Password (also applies to MySQL)

If the password in the database or /etc/psa/.psa.shadow has been changed and Plesk no longer allows a login, you can use this command to restore the login.

export PSA_PASSWORD=[new-password]

Rewrite web server configuration

If you have problems with a website/domain, this command can work wonders.

/usr/local/psa/admin/bin/httpdmng --reconfigure-all

Reconfigure/repair e-mail accounts

If a mailbox is corrupted, run this command to repair it.

/usr/local/psa/admin/sbin/mchk --with-spam

List email accounts and passwords

This tool can be useful for debugging, please pay attention to the security of the passwords, can refine results by adding |  command to grep


Plesk global php.ini



Create Plesk web user chroot with chroot shell

After the command in / etc / passwd, set the user's shell to / opt / psa / bin / chrootsh

/usr/local/psa/admin/bin/chrootmng --create --source=/var/www/vhosts/chroot/ --target=/var/www/vhosts/DOMAIN.TLD/web_users/USER --setup-user=USER

Update statistics for a domain

If the statistics for a domain are not correct, they can be regenerated as follows.

/usr/local/psa/admin/sbin/statistics --calculate-one --domain-name=<domain.tld>

Plesk Backup & Restore

Plesk backups are in the folder / var / lib / psa / dumps .

/usr/local/psa/bin/pleskbackup server
/usr/local/psa/bin/pleskrestore --restore 17_10_DOMAIN.tld_info_1110171034.xml -level clients

Fix: Fatal Exception

cd /opt/psa/admin/sbin
chmod 511 wrapper
chmod u+s wrapper

Fix: Apache2 Suexec problem

cp -a /usr/lib/plesk-9.0/suexec/psa-suexec /usr/lib/apache2/suexec
chmod u+s /usr/lib/apache2/suexec

Plesk Bootstrapper: The Panacea

If Plesk fails and nothing happens, the bootstrapper can still save the panel.
Here is an example for Plesk Panel 11.5.30 (pp 11.5.30 -bootstrapper), please adjust the version number of your Plesk version.

/usr/local/psa/bootstrapper/pp11.5.30-bootstrapper/ repair

Deactivate single sign-on

/usr/local/psa/bin/sso --disable

"%plesk_dir%/bin/sso" --disable

Plesk DNS Service named repair

systemctl list-unit-files | grep named
netstat -tunlep | grep :53
systemctl is-enabled named-chroot

Check resource intensive process

ps -auxf | sort -nr -k 4 | head -3

Find Out The Top 10 Memory Consuming Process
# ps -auxf | sort -nr -k 4 | head -10
Find Out top 10 CPU Consuming Process
# ps -auxf | sort -nr -k 3 | head -10

Install Letsencrypt SSL

certbot certonly --manual --preferred-challenges dns-01 -d *

Disk usage by folder

du -h --max-depth=1 | sort -hr
du -sh

Plesk subscription update

plesk bin subscription_settings -h
plesk bin subscription --switch-subscription <Domain-name> -service-plan Unlimited
plesk bin subscription_settings -i <domain-Name>

Generating self-signed SSL for Plesk for 10 years

cd /usr/local/psa/admin/conf/
mv httpsd.pem{,.old}
openssl req -new -nodes -x509 -out httpsd.pem -newkey rsa:2048 -keyout httpsd.pem -days 3650
/etc/init.d/sw-cp-server restart



Was this answer helpful?

« Back

<-- removed to be added again -->