Disk Commands
du — Disk Usage
# Show directory sizes
du -sh /path/to/dir
du -sh /* # top-level directories
du -sh * | sort -h # sorted by size
# Show all files and dirs
du -ah /path
# Exclude a directory
du -sh --exclude='/proc' /
ncdu — NCurses Disk Usage
ncdu is an interactive, curses-based disk usage viewer.
# Install
apt install ncdu
# Usage
ncdu / # analyze root
ncdu ~ # analyze home directory
ncdu -x / # stay on one filesystem (don't cross mount points)
Navigate with arrow keys, press d to delete, q to quit.
duf — Disk Usage Free
duf is a modern replacement for df with color output.
# Install
apt install duf
# Usage
duf # show all filesystems
duf /home # show specific path
duf --only local # only local filesystems
smartctl — S.M.A.R.T. Monitoring
# Install
apt install smartmontools
# Check drive health
smartctl -H /dev/sda
# Full info
smartctl -a /dev/sda
# Run short self-test
smartctl -t short /dev/sda
# Run long self-test
smartctl -t long /dev/sda
# View test results
smartctl -l selftest /dev/sda
HDSentinel
HDSentinel (Hard Disk Sentinel) provides detailed S.M.A.R.T. monitoring with health percentage scores.
# Download (Linux CLI version)
wget https://www.hdsentinel.com/hdslin/hdsentinel-019c-x86_64.gz
gunzip hdsentinel-019c-x86_64.gz
chmod +x hdsentinel-019c-x86_64
# Run
./hdsentinel-019c-x86_64
# Short report
./hdsentinel-019c-x86_64 -r