↑ ↓ select, Enter open, Esc close

Query Memcached statistics with netcat

Adjust the values, the command updates live
user@server
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) '

Sends the stats command to Memcached over the text protocol and filters out the most meaningful lines. bytes and limit_maxbytes show usage and limit, get_hits and get_misses show how effective the cache is. If evictions keeps rising, the memory (option -m in /etc/memcached.conf) is too small.

Note: Without the final grep, the full statistics are shown. If nothing answers, Memcached is not running or is listening on a different address.

Also searched as

  • is memcached running
  • memcached hit rate
  • memcached memory full

Related one-liners

All in Redis 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.