↑ ↓ select, Enter open, Esc close

#troubleshooting

19 one-liners with this tag.

All one-liners tagged troubleshooting

Analyze server errors (5xx) in the access log

#awk '$9 ~ /^5[0-9][0-9]$/ {print $9, $7}' /var/www/vhosts/system/example.com/logs/access_ssl_log | sort | uniq -c | sort -rn | head -20
harmlessLogs

Capture network traffic on a port with tcpdump

#tcpdump -i any -nn -c 100 port 25
harmlessNetwork

Check all MySQL tables for errors

#mysqlcheck --all-databases --check --silent
harmlessMySQL and MariaDB

Check all PHP files in a directory for syntax errors

$find /var/www/vhosts/example.com/httpdocs/wp-content/themes -name '*.php' -exec php -l {} \; 2>&1 | grep -v '^No syntax errors'
harmlessPHP

Check permissions along a path

$namei -l /var/www/vhosts/example.com/httpdocs/index.php
harmlessPermissions and ownership

Deactivate a single plugin despite a PHP fatal error

$wp plugin deactivate woocommerce --skip-plugins --skip-themes --path=/var/www/vhosts/example.com/httpdocs
cautionWP-CLI

Deactivate all plugins and save the active list

$wp plugin list --status=active --field=name --path=/var/www/vhosts/example.com/httpdocs > /var/www/vhosts/example.com/active-plugins.txt && wp plugin deactivate --all --path=/var/www/vhosts/example.com/httpdocs
cautionWP-CLI

Debug SSH connection problems with verbose output

$ssh -vvv -p 22 webuser@server.example.com
harmlessSSH

Enable the WordPress debug log without displaying errors

$wp config set WP_DEBUG true --raw --path=/var/www/vhosts/example.com/httpdocs && wp config set WP_DEBUG_LOG true --raw --path=/var/www/vhosts/example.com/httpdocs && wp config set WP_DEBUG_DISPLAY false --raw --path=/var/www/vhosts/example.com/httpdocs
cautionWP-CLI

Find the route and source IP for a destination

$ip route get 1.1.1.1
harmlessNetwork

Follow a log file live and filter by keywords

#tail -f /var/log/syslog | grep --line-buffered -iE "error|warn|fail"
harmlessLogs

Follow the error log of a Plesk domain live

#tail -f /var/www/vhosts/system/example.com/logs/error_log
harmlessLogs

List scheduled WP-Cron events

$wp cron event list --fields=hook,next_run_relative,recurrence --path=/var/www/vhosts/example.com/httpdocs
harmlessWP-CLI

Show all failed systemd units

$systemctl --failed --no-pager
harmlesssystemd

Show only error messages in the system journal

#journalctl -p err -b --no-pager
harmlessLogs

Show open files of a process

#lsof -p 1234
harmlessProcesses

Switch to a default WordPress theme

$wp theme activate twentytwentyfour --skip-themes --skip-plugins --path=/var/www/vhosts/example.com/httpdocs
cautionWP-CLI

Test a command in the minimal cron environment

$env -i SHELL=/bin/sh PATH=/usr/bin:/bin HOME="$HOME" LOGNAME="$(id -un)" /bin/sh -c 'wp --path=/var/www/vhosts/example.com/httpdocs cron event run --due-now'
harmlessCron

Test the MTU with ping

$ping -M do -s 1472 -c 3 example.com
harmlessNetwork

Read first, then run.

The commands on myline.de act directly on servers, files and databases. A wrong path or placeholder can delete data irreversibly or make a server unreachable.

  • All commands are provided without warranty and are not tested on every system.
  • Understand what a command does before running it, and check every placeholder.
  • Make a backup first and, if possible, try it on a test system.
  • You run commands at your own risk. Liability for damages is excluded to the extent permitted by law.