↑ ↓ select, Enter open, Esc close

#performance

18 one-liners with this tag.

All one-liners tagged performance

Analyze boot time and find slow services

$systemd-analyze && systemd-analyze blame --no-pager | head -20
harmlesssystemd

Check if LiteSpeed Cache serves a page from cache

$curl -s -o /dev/null -D - https://example.com/ | grep -iE "^(server|x-litespeed-cache[a-z-]*):"
harmlessLiteSpeed

Check PHP OPcache settings

$php -i | grep -E '^opcache\.(enable|enable_cli|memory_consumption|max_accelerated_files|validate_timestamps|revalidate_freq) '
harmlessPHP

Check the browser caching headers of a file

$curl -sI https://example.com/wp-includes/css/dist/block-library/style.min.css | grep -iE "^(cache-control|expires|etag|last-modified|age):"
harmlessnginx

Check whether a website serves gzip or Brotli

$curl -s -o /dev/null -D - -H "Accept-Encoding: br, gzip" https://example.com/ | grep -i "^content-encoding"
harmlessnginx

Check whether a website supports HTTP/2

$curl -sI --http2 https://example.com/ | head -1
harmlessnginx

Compare max connections with the peak so far

#mysql -e "SHOW GLOBAL STATUS LIKE 'Max_used_connections'; SHOW GLOBAL VARIABLES LIKE 'max_connections';"
harmlessMySQL and MariaDB

Delete expired transients from the WordPress database

$wp transient delete --expired --path=/var/www/vhosts/example.com/httpdocs
cautionWP-CLI

Enable the slow query log at runtime

#mysql -e 'SET GLOBAL slow_query_log = 1; SET GLOBAL long_query_time = 2; SHOW VARIABLES LIKE "slow_query_log_file";'
cautionMySQL and MariaDB

Find the 20 largest tables on the server

#mysql -e 'SELECT table_schema, table_name, ROUND((data_length + index_length) / 1024 / 1024, 1) AS mb, table_rows FROM information_schema.tables ORDER BY data_length + index_length DESC LIMIT 20;'
harmlessMySQL and MariaDB

Find the largest autoloaded options in WordPress

$wp option list --autoload=on --orderby=size_bytes --order=desc --fields=option_name,size_bytes --path=/var/www/vhosts/example.com/httpdocs | head -n 20
harmlessWP-CLI

Measure HTTP load times and TTFB with curl

$curl -o /dev/null -sS -w 'DNS: %{time_namelookup}s Connect: %{time_connect}s TLS: %{time_appconnect}s TTFB: %{time_starttransfer}s Gesamt: %{time_total}s\n' https://example.com/
harmlessNetwork

Measure the HTML and header size of a page

$curl -s -o /dev/null -w 'Status: %{http_code} Header: %{size_header} Bytes HTML: %{size_download} Bytes\n' https://example.com/
harmlessSEO checks

Optimize the WordPress database

$wp db optimize --path=/var/www/vhosts/example.com/httpdocs
cautionWP-CLI

Reuse SSH connections with ControlMaster

$ssh -o ControlMaster=auto -o ControlPath=~/.ssh/cm-%C -o ControlPersist=10m webuser@server.example.com
harmlessSSH

Show running MySQL queries without idle connections

#mysql -e "SELECT id, user, db, time, state, LEFT(info, 100) AS query FROM information_schema.processlist WHERE command <> 'Sleep' ORDER BY time DESC;"
harmlessMySQL and MariaDB

Show slow Redis commands (SLOWLOG)

$redis-cli SLOWLOG GET 10
harmlessRedis and Memcached

Show the Redis cache hit rate

$redis-cli INFO stats | grep -E '^(keyspace_hits|keyspace_misses|evicted_keys|expired_keys):'
harmlessRedis and Memcached

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.