Operating System - HP-UX
1832927 Members
2870 Online
110048 Solutions
New Discussion

how can i find the file that it increased most quickly?

 
SOLVED
Go to solution
常有慈悲心
Regular Advisor

how can i find the file that it increased most quickly?

thanks
5 REPLIES 5
Steven E. Protter
Exalted Contributor
Solution

Re: how can i find the file that it increased most quickly?

To do this, you have to take snaphots, or collect some kind of data over time.

Here is a simple way.


filename=$(date)
cd /
du -k | sort -rn > /tmp/$filename

Have cron run it once a day.

Then you can compare the data between the two files and figure out which one had the most growth.

I don't have time to script that right now, but if you look at the output you'll get the idea.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Hein van den Heuvel
Honored Contributor

Re: how can i find the file that it increased most quickly?


You might want to reduce the number of files to monitor by setting a lower threshold of say 2.5MB, suggesting that any growth below that level is not too interesting.

So that would mean something like (untested)

filename=$(date)
find / -size +5000 -exec du -k {} \; | sort -k 2 > /xxx/$filename.xxx
:
diff...

Hein.




Sridhar Bhaskarla
Honored Contributor

Re: how can i find the file that it increased most quickly?

Hi,

I would rely on the size and a recent time stamp of it. For ex., if you are seeing it increased in the last 5 minutes, then find all the files that are above 10 MB but modified within last 5 mins. To do that, touch a file with a time stamp less than five minutes ago and then use it as a reference with -newer option.

touch 1019103004 /tmp/stamp
find /directory -newer /tmp/stamp -size 10000000c

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Hein van den Heuvel
Honored Contributor

Re: how can i find the file that it increased most quickly?

Yes, excellent plan to not only take the size into account, but also the modification time. If it is a small file, it is not intesting. If it is a large files, but has not changed for days/weeks (like the Oracle executable), then it is not interesting either. The whole point being to weed out the bulk of the data and focus on real candidates with minimal effort.

Hein.
Muthukumar_5
Honored Contributor

Re: how can i find the file that it increased most quickly?

We can use ls with -s option to get file size there. IF you want to collect only files then,

find / -type f -exec ls -s {} \; > /tmp/sizereport_$(date +'%b_%e_%H')

do cron this, so that you will get reports based on the cron execution time.

It will give format of file informations as,

size filename.

Log file represents /tmp/sizereport_Month_date_hour

HTH.
Easy to suggest when don't know about the problem!