Server Administration

Handy commands for diagnosing and maintaining production servers.

1. Find Large Files and Sort by Size

sudo du -h / | sort -rh | head -5
23G     /
7.6G    /var
6.6G    /var/lib
6.4G    /var/lib/docker
2.8G    /var/lib/docker/volumes

2. Clear the Page Cache

Linux offers multiple cache layers. The following sequence clears only the page cache, which is safe to run on production servers.

First switch to the superuser account.

sudo su

Then drop the page cache.

sync; echo 1 > /proc/sys/vm/drop_caches

References

Published: January 16, 2022