Intro to Shell (CLI) for Plesk Linux

There’s a lot of Linux shell intro guides out there. There’s also a lot of intro to Plesk guides out there. But what you don’t find as often is a great reference guide to help you find the most common paths and command line utilities for managing your Linux VPS or dedicated server running Plesk.

For example, finding where Plesk stores your vhost files and how it changes paths to common utilities is very handy information to know,… and so we’ve provided it below. Please feel free to bookmark this page and use it as a regular reference, at least until you’ve got it all memorized!

Before we get started, if you haven’t got any experience with Linux shell, check out one of the many intro to Linux shell guides you can find with a Google search, then come on back to learn the specifics of exploring Plesk from shell.

Common Paths

User Home Directory: /var/www/vhosts/<primary_domain>

This is the same one you see when you open the File Manager in Plesk.

Within that directory will be a few others, such as httpdocs — the default web root for your primary domain — and possibly others that you’ve configured as web roots for add-on domains. The defaults for those add-on domains are simply the domain name itself, but you may have configured them differently (Plesk gives you the choice when you add the domain).

Mail Storage Directory: /var/qmail/mailnames/<domain>/<mailname>

Where the mailname is the first part of the email address, such as ‘john’ from john@smith.com.

Even though the directory ‘qmail’ would imply it’s for the qmail mail server, even when you use postfix, Plesk stores messages at this path.

Within the Maildir, your mail folders are hidden folders, meaning they start with a period (.) and will only be visible using the ‘ls -al’ command. For example, your default Spam folder will be called: .Spam

Plesk Binary Directory: /usr/local/psa/bin

In recent versions (12+), the Plesk devs have also provide a shorthand mechanism for accessing Plesk binaries:

plesk bin <command>

In case you wanted to avoid typing /usr/local/psa/bin

Plesk PHP Binary Directory: /opt/plesk/php/<version>/bin

For example for PHP 7.0 the directory is /opt/plesk/php/7.0/bin/php

The built in OS binaries are often the default in Plesk, and they’re in the usual place: /bin/php, but these are where you find the additional selectable versions.

Web Server Config Files

These are all fairly standard.

Apache: /etc/httpd/conf/httpd.conf for the core config, and /etc/httpd/conf.d/ for most of the extras.

Plesk stores its specific configs in /etc/httpd/conf/plesk.conf.d/

Nginx: /etc/nginx/nginx.conf and /etc/nginx/conf.d for most of the extras.

Plesk stores its specific configs in /etc/nginx/plesk.conf.d/

But! Each vhost has its own area where you’re expected to add config and make changes:

Apache: /var/www/vhosts/system/<domain>/conf/vhost.conf
Nginx: /var/www/vhosts/system/<domain>/conf/vhost_nginx.conf

These files are also editable from within Plesk (only if you’re an admin) when you choose “Apache and nginx config” under any given domain. Near the bottom of each of the apache and nginx sections are the advanced configurations which edit these files.

You’ll notice that these paths are similar to those to the vhost’s web roots, but are instead contained within the system folder in the vhosts path. In the past few years Plesk moved these config files out of the user root folder and into that system folder for better security and to ensure all configs are available in one spot.

Handy Binaries / Programs

htop

We install this when you have us set up your server (Platinum management). It’s a great utility for easy monitoring of system services. It shows you real-time memory and CPU usage as well as a list of active processes in order (by default) of CPU usage.

lsof -p <process_id>

While most processes make it pretty clear what website they belong to by listing the system user that triggered it, if a process does not have such an indicator, the above lsof command can help to narrow that down by listing all of the files that a process is accessing.

You’ll need to use htop to find the process ID before running this.

It’s going to spit out a comprehensive list of every single file the program uses. Most of the stuff at the top of the list are builtin system libraries that aren’t going to tell you much. You’ll probably find the info you want closer to the bottom of the list of open files, such as the currently active socket file (which often has a path leading to the website’s vhost root) or even more straightforward: an open log file that leads to the vhost system root.

plesk bin domain -l

If you read above you’ll know that the ‘plesk bin’ prefix means we’re calling the ‘domain’ tool from Plesk’s binary path via shorthand. domain -l is simply going to pull a list of hosted domains (including subdomains) from Plesk’s database for you.

You can then run plesk bin domain -i <domain> to get more info about the domain.


This article is a work in progress. If there’s some Plesk-related info you think we’re missing that you would like to know how to access from the command line, let us know! We’re always looking to improve our guides.

Jordan is a computer, security, and network systems expert and a lover of all things web and tech. Jordan consults with project management for software companies. Jordan is a founder and managing partner at Websavers Inc.

Leave a Comment