Linux - Low space check

##################### low space : ################################

1. [root@app2 ~]# df -kh  :  (disk filesystem check which partition got low space : preferably user df -hP


2. [root@app2~]# df -hP /opt/Oracle/
Filesystem            Size  Used Avail Use% Mounted on
/dev/oracle_vg-oracle_lv   40G   32G  5.7G  85% /opt/Oracle
 

3. [root@app2 Oracle]# du -sck * | sort -n     (disk usage  - sck :  s is subfolder, k is size in 1024 bytes units)

OR  du -sck * --block-size=1GB | sort -n

4 lost+found
5942460 em12c-media
27139136 em12c
33081600 total


4. File deleting/Cleanup
User following command to find and remove files
1)  ls -tr | head -n 1   -- check the oldest file
 find ./ -name  '*.txt' -mtime +XX    --- modified more than XX days ago
 find ./ -name  '*' -mtime +40 | wc -l
 find ./ -name  '*' -mtime +40 -exec rm -rf {} \;    --- delete files are modified 40 days ago

 find ./ -name  '*' -mtime +40 | wc -l

5. delete the content of a file: 

A easiest way to empty or blank a file content using shell redirect null (non-existent object) to the file as below:


你可能感兴趣的:(Linux - Low space check)