How to find the file that is growing

I am having a log directory which contains many sub directories which has many log files .And one or two files keeps on growing.I cud not find out the exact file/files which is growing.Can any one help me to find out the culprit?

Who is Participating?
wesly_chenConnect With a Mentor Commented:
du -k /path/to/logs | sort -nr
the biggest size of files will be on top of the list.
You can do it inspecting the date of file's modification
For example
find /var/log -ctime -1 -exec ls -lA {} \;
This command would list the files whos modification date is a day ago.
It sounds like the simplest approach would be "du -h /path/to/logs"; this will give a hierarchal breakdown of each directory and subdirectory's size.  -k specifies kilobytes, -m megabytes, and -h gigabytes.  It will use a lower number if appropriate, e.g. it will print 500m rather than 0.5g

Also of note is you can pass --max-depth=N to specify how many levels down to go (good for preliminary overview, e.g. specifying only two subdirs, so the output is more readily reviewed to find the subdirectories containing the large files).  Also useful is the -s switch, which will show a single total (e.g. total size of /var/log) without showing subdirectory sizes.  However, if you do du -hs /var/log/* it will show sizes of individual files as well; in that case, use --max-depth=1 to only report on subdirectories.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.