How to find the file that is growing

Posted on 2005-04-21
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
    LVL 2

    Expert Comment

    LVL 8

    Expert Comment

    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.
    LVL 7

    Expert Comment

    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

    du -k /path/to/logs | sort -nr
    the biggest size of files will be on top of the list.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    rdate is a Linux command and the network time protocol for immediate date and time setup from another machine. The clocks are synchronized by entering rdate with the -s switch (command without switch just checks the time but does not set anything). …
    Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
    Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
    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…

    760 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

    Need Help in Real-Time?

    Connect with top rated Experts

    7 Experts available now in Live!

    Get 1:1 Help Now