Welcome

Welcome to my technical blog. Here I will try to provide little tips, tricks and ideas, related to UNIX/Linux. And here is the first: Use this code to get size of directories. This will help you easy find where diskspace disappear:
du -sk /directory/*
Here is one example
du -sk /var/*
0       /var/account
0       /var/adm
149752  /var/cache
0       /var/crash
8       /var/db
0       /var/empty
0       /var/games
0       /var/gopher
0       /var/kerberos
208928  /var/lib
0       /var/local
0       /var/lock
5868    /var/log
0       /var/mail
0       /var/nis
0       /var/opt
0       /var/preserve
0       /var/run
4       /var/spool
0       /var/target
179572  /var/tmp

But we should browse a lot so let sort the output by size
du -sk /var/*|sort -g
0       /var/account
0       /var/adm
0       /var/crash
0       /var/empty
0       /var/games
0       /var/gopher
0       /var/kerberos
0       /var/local
0       /var/lock
0       /var/mail
0       /var/nis
0       /var/opt       
0       /var/preserve  
0       /var/run       
0       /var/target    
0       /var/yp        
4       /var/spool     
8       /var/db        
5868    /var/log       
149752  /var/cache     
179572  /var/tmp       
208928  /var/lib  
 
And we do not need so much lines, so let get only few last
du -sk /var/*|sort -g|tail -5                       
8       /var/db
5872    /var/log
149752  /var/cache
179572  /var/tmp
208928  /var/lib

E voila, we have candidate directories to search for space eater

No comments:

Post a Comment

Should I trust AI

 Should I trust AI? So far no, sorry.  I tested for the moment (May, 2025) most advanced model for programming and ask very simple question:...