Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

finding all files over 100m in du -sh /var/lib/mysql/* 2

Status
Not open for further replies.

farley99

MIS
Feb 12, 2003
413
US
How do i select only files over 100M in du -sh /var/lib/mysql/* ?
 
Code:
du -sh /var/log/* | awk ' {
              if ($1 ~ /k/) {
               sub(/\./,"",$1)
               sub(/k/,"",$1)
               if ($1 > 100) {
                  print
               }
            } else if ($1 ~ /M/) {
               sub(/M/," Megabytes",$1) ; print
          }
}'

OP:
1.5 Megabytes /var/log/lastlog
3.0 Megabytes /var/log/mail
1.4 Megabytes /var/log/messages
116 /var/log/messages-20030201.gz
104 /var/log/messages-20030221.gz
204 /var/log/messages-20030602.gz
948 /var/log/warn
140 /var/log/warn-20030602.gz
304 /var/log/wtmp
3.4 Megabytes /var/log/xferlog
596 /var/log/y2log

Probably a better way.
 
farley99,

Unless for some reason you just HAVE to use du, there is a much better way..

for enough information to make your head spin, see man find.

But the quick answer is:

find /var/lib/mysql/ -size +1000000c -exec ls -la {} \;

This command will find files over 1,000,000 bytes, and display them and there full path via ls -la
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top