Friday, 9 October 2015

Space Check - Linux / Unix

=========
[root@pdb01.in1.dbms.com pgsql]# date;hostname;df -h|grep /apps;du -sh *|grep data
Thu Oct  8 04:24:56 GMT 2015
pdb01.in1.dbms.com
/dev/mapper/vg0-lv_apps   29G   27G  331M  97% /apps
30G     data
=========


Top 20 large files Findings:
====================
find /u02 /type f -printf '%s%p\n' | sort -nr | head -20
|find /u02 /type f -printf '%s%p\n' | sort -nr | head -20 | awk '{print $1/1024/1024/1024 "GB" " $2}'

or

[user@srv-01]$ find /usr/ -xdev -depth -type f -ls |sort -nr -k 7 |head -20 | awk '{print $7,$11}'

More Find commands available from below website too:
========================================
Reference:  http://shannuradba.blogspot.co.uk/2012/07/find-command-with-examples.html

To see the size of the folder:


du -sk *| sort -nr

Examples:

[root@rac1 ~]# cd /
[root@rac1 /]# pwd
/
[root@rac1 /]# du -sk *| sort -nr