#statistics
6 one-liners with this tag.
All one-liners tagged statistics
Calculate the average, minimum and maximum of a column
$awk -v c=2 'NR == 1 {min = max = $c} {s += $c; if ($c < min) min = $c; if ($c > max) max = $c} END {if (NR) printf "n=%d avg=%.2f min=%s max=%s\n", NR, s/NR, min, max}' measurements.txt
Count requests per minute in the access log
#awk '{print substr($4, 2, 17)}' /var/www/vhosts/system/example.com/logs/access_ssl_log | sort | uniq -c | sort -rn | head -20
Count WordPress posts by status
$wp post list --post_type=post --post_status=any --field=post_status --path=/var/www/vhosts/example.com/httpdocs | sort | uniq -c
Query Memcached statistics with netcat
$printf 'stats\nquit\n' | nc 127.0.0.1 11211 | grep -E 'STAT (curr_items|bytes|limit_maxbytes|get_hits|get_misses|evictions|curr_connections) '
Show the Redis cache hit rate
$redis-cli INFO stats | grep -E '^(keyspace_hits|keyspace_misses|evicted_keys|expired_keys):'
Show traffic and error counters of a network interface
$ip -s link show eth0