Ncdu is way better than dealing with du, it's worth installing instead of sticking to built ins.
Linux
Everything about Linux
RULES
-
Be nice to each other.
-
No memes or pictures of Linux in the wild.
Good call on ncdu. I use it all the time for finding what's eating disk space. The interactive TUI is way faster than piping du through sort. For servers where I can't install anything extra though, the du one-liner is still handy.
Nice! Thank you. :)
Expanding on the disk usage one, I wrote a tutorial for that which goes a bit deeper:
https://sciactive.com/2022/06/02/how-to-find-what-is-using-your-disk-space-on-a-linux-server/
Thanks! I use a lot of these daily for quick checks. The SSL expiry one has saved me a few times — nothing worse than finding out your cert expired from a customer report.
I also have a cron that runs curl -s http://5.78.129.127/api/ssl/mydomain.com | jq '.days_remaining' and alerts me when it drops below 14 days.
That’s smart! I’m stealing that!
I use new a lot. Just an ugly function I wrote to show the newest files in a directory, but handy for those "what the hell was that file I was just working on named?" moments. Defaults to the newest 15 if not given an arg.
new ()
{
if [[ $# -ne 1 ]]; then
num=15;
else
num="$1";
fi;
num=$((num+1));
/usr/bin/ls -lth | head -"$num"
}