Monday, 15 December 2014

Linux helpful space utililization commands

Command to find all log files that are older than two days


  • find –name '*.log' –mtime +2 -exec ls –l {} \;


Command to find and delete all log files that are older than two days


  • find -name '*.log' -mtime +2 -exec rm {} \;


Command to find files with size more than 50 MB


  • find . -type f -size +50000k -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'

Command to display dir structure with size in GB

  • du -h ./ | grep ^[0-9.]*G

No comments:

Post a Comment