From 626ba837c8a4d3a797d7f6af4d9925cf01395611 Mon Sep 17 00:00:00 2001 From: francesco Date: Wed, 13 Oct 2021 01:05:46 +0200 Subject: [PATCH] add `du`-command :computer: --- docs/bash.md | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/docs/bash.md b/docs/bash.md index a784354..357e18b 100644 --- a/docs/bash.md +++ b/docs/bash.md @@ -16,4 +16,47 @@ the previous command is due that not all `find` have a delete funcion but with o Find and delete with no overhead ```bash find / -name .DS_Store -print0 | xargs -0 rm +``` + +## du + +du - estimate file space usage [man-page](https://man7.org/linux/man-pages/man1/du.1.html) + +[example How to Get the Size of a Directory in Linux](https://linuxize.com/post/how-get-size-of-file-directory-linux/) + +```bash +sudo du -sh /var + +# Output +85G /var +``` + +```bash +sudo du -shc /var/* + +# Output +24K /var/db +4.0K /var/empty +4.0K /var/games +77G /var/lib +4.0K /var/local +0 /var/lock +3.3G /var/log +0 /var/mail +4.0K /var/opt +0 /var/run +196K /var/spool +28K /var/tmp +85G total +``` + +```bash +sudo du -h /var/ | sort -rh | head -5 + +# Output +85G /var/ +77G /var/lib +75G /var/lib/libvirt/images +75G /var/lib/libvirt +5.0G /var/cache/pacman/pkg ``` \ No newline at end of file