Databases bash Intermediate

Redis Memory Usage Report

Report the top 20 Redis keys by memory usage using MEMORY USAGE command.

bash
#!/bin/bash
redis-cli --no-auth-warning -u ${REDIS_URL} \
  SCAN 0 COUNT 1000 | tail -n +2 | \
  xargs -I{} sh -c 'printf "%s %s
" $(redis-cli MEMORY USAGE {}) {}' | \
  sort -rn | head -20

Prerequisites

  • redis-cli
  • Redis >= 4

Pro Tips

  • → Run OBJECT ENCODING key to see per-key data structure.

Was this module useful?

Share your experience — it helps the team improve.

Leave Feedback

Commercial Licensing

Acquire a production access token or template license for enterprise deployment.

Module Info

Language
bash
Level
Intermediate
Read time
3 min
Published
Feb 2026
License
Commercial License

Newsletter

New modules every week, directly to your inbox.