August 25, 2009

Ordering files size in du -sh output

Posted in Solaris at 8:40 am by alessiodini

When i run du -sh command i can see every file size , but if i want obtain a ordered list?
With these commands i can accomplish this:

[root@server]#pwd
/var

[root@server]# \du -sh * | tee /tmp/prova.txt | grep ‘[0-9]\{1,3\}G’ | sort -rn ; cat /tmp/prova.txt | grep ‘[0-9]\{1,3\}M’ | sort -rn ; cat /tmp/prova.txt | grep ‘[0-9]\{1,3\}K’ | sort -rn ; rm /tmp/prova.txt
1.2G spool
1.1G sadm
239M apache2
139M opt
45M smop
38M tmp
[…]
983K cron
937K lib
552K lp
162K cache
153K ldap
131K snmp
128K run
74K preserve
[…]

GOOD!!!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: