How to find the file that is growing

Posted on 2005-04-21
Medium Priority
Last Modified: 2013-12-15
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?

Question by:srps1579

Expert Comment

ID: 13831684

Expert Comment

ID: 13833846
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.

Expert Comment

ID: 13837455
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.
LVL 38

Accepted Solution

wesly_chen earned 375 total points
ID: 13856455
du -k /path/to/logs | sort -nr
the biggest size of files will be on top of the list.

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Often times it's very very easy to extend a volume on a Linux instance in AWS, but impossible to shrink it. I wanted to contribute to the experts-exchange community a way of providing a procedure that works on an AWS instance. It can also be used on…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Suggested Courses
Course of the Month14 days, 7 hours left to enroll

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question