Mastering Important Linux Commands in cPanel/WHM Environments (Emergency + Daily Ops Runbook)

Table of Contents

Control panels simplify server management, but they do not replace the Linux operating system underneath. Every cPanel/WHM server ultimately runs on a Linux distribution โ€” typically AlmaLinux, Rocky Linux, or CloudLinux โ€” and when WHM/cPanel becomes slow, unstable, or unreachable, the command line is where recovery happens.

This guide is intentionally bookmarkโ€‘worthy: it focuses on commands and checks you use when you are under pressure (panel down, high load, mail queue runaway, disk full, license errors, services flapping). It also includes cPanel-native service scripts that are safer than โ€œblind restarts.โ€

Related reading:


1) First 90 Seconds: Triage Checklist (Before You Touch Anything)

Goal: confirm what is failing and avoid making it worse.

  1. Confirm you are on the right server:
hostname -f; uname -r; date
  1. Is the server alive / responsive?
uptime
  1. Is load caused by CPU, memory, or disk I/O?
top -o %CPU
free -h
  1. Is the disk full or inodes exhausted?
df -h
 df -i
  1. Quick โ€œwhat changed?โ€ context:
last -n 5
journalctl -p err -n 50 --no-pager

Rule: If disk is 100% full or inodes are 100% used, fix that first. Many services break when they cannot write logs, temp files, or sockets.


2) When WHM/cPanel Is Down: The Core Services to Check

The panel relies on cPanel services and OS services.

A) Check cPanelโ€™s main service (cpsrvd)

systemctl status cpsrvd --no-pager

If it is down, restart the cPanel way:

/usr/local/cpanel/scripts/restartsrv_cpsrvd

B) Check key backend services

systemctl status httpd --no-pager
systemctl status nginx --no-pager
systemctl status mariadb --no-pager || systemctl status mysqld --no-pager
systemctl status exim --no-pager
systemctl status dovecot --no-pager
systemctl status named --no-pager

Tip: Use cPanelโ€™s restartsrv scripts when available:

/usr/local/cpanel/scripts/restartsrv_httpd
/usr/local/cpanel/scripts/restartsrv_mysql
/usr/local/cpanel/scripts/restartsrv_exim
/usr/local/cpanel/scripts/restartsrv_dovecot
/usr/local/cpanel/scripts/restartsrv_named

(These scripts are part of cPanelโ€™s service management tooling.)


3) The Logs You Actually Need (Not Random /var/log Guessing)

A) cPanel/WHM application logs

ls -lh /usr/local/cpanel/logs/

Common high-signal logs:

  • error_logย (cPanel application errors)
  • access_logย (requests hitting cPanel)
  • login_logย (login activity)
  • license_logย (license verification issues)
  • tailwatchd_logย (service monitoring actions)

B) Service health monitoring logs

chkservd is a cPanel service monitor (TailWatch driver). Review:

tail -n 200 /var/log/chkservd.log

TailWatch driver output:

tail -n 200 /usr/local/cpanel/logs/tailwatchd_log

C) System logs (service failures, kernel issues)

journalctl -u cpsrvd -n 200 --no-pager
journalctl -u httpd -n 200 --no-pager
journalctl -u mariadb -n 200 --no-pager || journalctl -u mysqld -n 200 --no-pager

4) License Errors That Break WHM: Fast Recovery Commands

Symptoms you might see:

  • โ€œInvalid License Fileโ€
  • โ€œLicense file is for the futureโ€
  • WHM shows trial mode / license warnings

A) Force license refresh

/usr/local/cpanel/cpkeyclt

B) If the error hints at time drift

Verify server time and time sync:

date
 timedatectl status

Then restart cpsrvd and run license refresh:

/usr/local/cpanel/scripts/restartsrv_cpsrvd
/usr/local/cpanel/cpkeyclt

5) High Load on cPanel Servers: Find the Real Cause (Fast)

A) Identify top CPU consumers

ps aux --sort=-%cpu | head -n 20

B) Identify top memory consumers

ps aux --sort=-%mem | head -n 20

C) Find โ€œtoo many processesโ€ per user (common in shared hosting)

ps -eo user= | sort | uniq -c | sort -nr | head

D) Find web server overload

Apache status (if enabled) + logs:

tail -n 200 /usr/local/apache/logs/error_log

E) Confirm whether disk I/O is the bottleneck

If available:

iostat -x 1 5

If WHM is slow but SSH is fast, it is often a cPanel internal task or a service monitor loop โ€” check TailWatch / chkservd logs.


6) Disk Full / Inodes Full: The Top cPanel Culprits

A) Quick disk and inode check

df -h; df -i

B) Find the largest directories (safe overview)

du -xhd1 /home /var /usr/local 2>/dev/null | sort -h

C) Common culprits on cPanel servers

  • Backups and archives
  • Massive mail directories
  • Logs
  • Temporary files

Quick checks:

du -sh /usr/local/cpanel/logs 2>/dev/null
 du -sh /var/log 2>/dev/null
 du -sh /home/*/mail 2>/dev/null | sort -h | tail

Safety note: Do not delete randomly. Identify first, then clean with a plan.


7) Mail Queue Runaway (Spam / Bounces / Stuck Delivery)

A) Check queue size

exim -bpc

B) Inspect recent queue activity

exim -bp | head -n 50

C) Look for the top sending domains/users

grep -E "<= .* U=" /var/log/exim_mainlog | tail -n 200

If a server is blacklisted or mail is delayed, queue health is often the first clue.


8) DNS Problems: Quick Verification

A) Is named running?

systemctl status named --no-pager

B) Test resolution from the server

dig +short example.com
 dig +short @127.0.0.1 example.com

If local resolution fails but external works, named config / zone issues may exist.


9) MySQL/MariaDB Under Pressure: Minimal Safe Commands

A) Confirm service health

systemctl status mariadb --no-pager || systemctl status mysqld --no-pager

B) Quick connections and threads snapshot

mysqladmin processlist

For deeper recovery and safe repair flows, use our dedicated guide: Diagnosing MySQL server issues.


10) When Services Keep Restarting: chkservd / TailWatch Controls

cPanel uses TailWatch and its chkservd driver to monitor services and attempt restarts.

A) Restart chkservd cleanly

/usr/local/cpanel/scripts/restartsrv_chkservd

B) Review why it is restarting services

tail -n 200 /var/log/chkservd.log

C) TailWatch main log

tail -n 200 /usr/local/cpanel/logs/tailwatchd_log

If services are flapping, logs will show what chkservd observed and what it attempted.


11) Safe Session Management (Because SSH Drops)

On production servers, never risk losing a long repair session.

screen -S rescue
# or
 tmux new -s rescue

12) Practical Decision: When CLI Beats WHM

Use CLI when:

  • WHM UI is unresponsive
  • High load blocks GUI
  • Disk is full and services canโ€™t write
  • License errors lock you out
  • Mail queue is exploding
  • You need fast log correlation

Panels provide convenience โ€” but the OS retains authority.


Final Thoughts

If you manage Cloud or dedicated infrastructure, commandโ€‘line proficiency is not an optional skill โ€” it is your recovery toolkit.

This guide is designed to be the โ€œfirst bookmarkโ€ you open when something breaks.

Share:

Facebook
Twitter
Pinterest
LinkedIn