LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 04-23-2010, 01:01 PM   #1
dnaqvi
Member
 
Registered: Oct 2009
Posts: 117

Rep: Reputation: 15
find continuously growing files in the file system


How to find continuously growing files in the file system?
 
Old 04-23-2010, 02:55 PM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
Create an empty file with touch:
touch /tmp/testfile

Wait a minute then do a find in the filesystem for any files newer than /tmp/testfile:

find /<filesystem> -newer /tmp/testfile

Last edited by MensaWater; 04-26-2010 at 10:03 AM.
 
Old 04-23-2010, 03:05 PM   #3
Hi_This_is_Dev
Member
 
Registered: May 2009
Location: India
Distribution: On my PC I use RHEL, at office AIX, Solaris, HP-UX, RHEL.
Posts: 254

Rep: Reputation: 18
Quote:
Originally Posted by dnaqvi View Post
How to find continuously growing files in the file system?
Well, I am not getting your question thoroughly. I figure out this:

  1. You want to keep an eye on files or logs which are being updated in real-time.

    Code:
    tail -f logFileName
    This gives the real-time view of your (log) file as data are being added to it (appended at the end of it).

    I was asked this question in an interview I appeared in recently. And I forgot the flag "-f" even though I had studied it.

  2. You want to search for files whose size is comparatively larger.

    This shows up storage being used by files and directories:

    Code:
    -sh-3.2$ du -h
    8.0K    ./Mail
    8.0K    ./bin
    8.0K    ./hello
    8.0K    ./.mozilla/plugins
    8.0K    ./.mozilla/extensions
    24K     ./.mozilla
    112K    .
    -sh-3.2$
    Code:
    [root@localhost ~]# du -h bin/
    8.0K    bin/scripts
    216K    bin/
    [root@localhost ~]#

Last edited by Hi_This_is_Dev; 04-23-2010 at 03:07 PM.
 
Old 04-23-2010, 03:13 PM   #4
Hi_This_is_Dev
Member
 
Registered: May 2009
Location: India
Distribution: On my PC I use RHEL, at office AIX, Solaris, HP-UX, RHEL.
Posts: 254

Rep: Reputation: 18
Quote:
Originally Posted by MensaWater View Post
Create an empty file with touch:
touch /tmp/testfile

Wait a minute then do a find in the filesystem for any files newer than /tmp/testfile:

find /<filesystem> /tmp/testfile
I just have tried what you suggested to the asker:


Code:
[root@localhost ~]# touch /tmp/test
[root@localhost ~]# ll /tmp/test
-rw-r--r-- 1 root root 0 Apr 24 01:38 /tmp/test
[root@localhost ~]# cal 2008 > /tmp/test2
[root@localhost ~]# find /tmp/ /tmp/test
/tmp/

Output:

Code:
/tmp/orbit-root
/tmp/orbit-root/linc-1790-0-29afaaf0f1854
/tmp/orbit-root/linc-17f3-0-5907431b3f294
/tmp/orbit-root/linc-17f9-0-1ed30d255aed9
/tmp/orbit-root/linc-17f7-0-6ed0d466c14aa
/tmp/orbit-root/linc-17f5-0-59074306174d6
/tmp/orbit-root/linc-180f-0-6773584510b0b
/tmp/orbit-root/linc-1825-0-69f64e894de1f
/tmp/orbit-root/bonobo-activation-register.lock
/tmp/orbit-root/linc-17d5-0-5d50c57cdcfa3
/tmp/orbit-root/linc-180d-0-67fad0f6b3fd9
/tmp/orbit-root/linc-17db-0-34cd848a2b75
/tmp/orbit-root/linc-1806-0-4ff4e8477112c
/tmp/orbit-root/linc-1801-0-a71fe92597f5
/tmp/orbit-root/linc-185e-0-3cdf6335454cd
/tmp/orbit-root/linc-17fd-0-171e788173b5a
/tmp/orbit-root/linc-1828-0-6d4a2e039105d
/tmp/orbit-root/linc-184a-0-2707f601501b9
/tmp/orbit-root/linc-17ed-0-552508f51ec89
/tmp/orbit-root/linc-1843-0-522629c0770b5
/tmp/orbit-root/linc-1818-0-3df5ef3f40461
/tmp/orbit-root/linc-1860-0-3cdf63352e01b
/tmp/orbit-root/linc-185a-0-4bd09e1064533
/tmp/orbit-root/bonobo-activation-server-ior
/tmp/test
/tmp/.X0-lock
/tmp/archive
/tmp/.gdmUH01BV
/tmp/lost+found
/tmp/keyring-LAcNZD
/tmp/keyring-LAcNZD/socket
/tmp/test2
/tmp/gconfd-root
/tmp/gconfd-root/lock
/tmp/gconfd-root/lock/ior
/tmp/loginReport
/tmp/virtual-root.4WvSdA
/tmp/.esd
/tmp/.esd/socket
/tmp/mapping-root
/tmp/.X11-unix
/tmp/.X11-unix/X0
/tmp/virtual-root.AWP4up
/tmp/keyring-MNqrk4
/tmp/keyring-MNqrk4/socket
/tmp/.gdm_socket
/tmp/.font-unix
/tmp/.font-unix/fs7100
/tmp/dev.txt
/tmp/ssh-PVASmx6032
/tmp/ssh-PVASmx6032/agent.6032
/tmp/.ICE-unix
/tmp/.ICE-unix/6032
/tmp/test
[root@localhost ~]#

Well, I didn't get your point. Could you please explain it a little more?
 
Old 04-23-2010, 06:09 PM   #5
dnaqvi
Member
 
Registered: Oct 2009
Posts: 117

Original Poster
Rep: Reputation: 15
cronjob

Hello,

OS: Linux

I need to run the files everyday at 11.00 pm (Monday to Friday).

How would I put on cronjob?
I have files ready.

thanks
 
Old 04-26-2010, 04:03 AM   #6
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,553

Rep: Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946
Quote:
Originally Posted by dnaqvi View Post
Hello,

OS: Linux

I need to run the files everyday at 11.00 pm (Monday to Friday).

How would I put on cronjob?
I have files ready.

thanks
Don't post the same question twice, and don't tack questions onto the bottoms of other threads.
 
Old 04-26-2010, 10:06 AM   #7
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
Quote:
Well, I didn't get your point. Could you please explain it a little more?
Oops - There should have been a "-newer" flag in the find. I've edited my original post to have that. Thanks for pointing it out.

The idea is that testfile will have the current time/date on it. When you run the find command 1 minute later it will show you only those files that have updated since you created testfile so it should be easy to determine which ones are growing simply by monitoring those.

Note that <directory> could be anything: /var, /, /usr, /usr/local/bin, /usr/lib, /var/log etc...
 
Old 04-26-2010, 02:12 PM   #8
Hi_This_is_Dev
Member
 
Registered: May 2009
Location: India
Distribution: On my PC I use RHEL, at office AIX, Solaris, HP-UX, RHEL.
Posts: 254

Rep: Reputation: 18
Quote:
Originally Posted by MensaWater View Post
Oops - There should have been a "-newer" flag in the find. I've edited my original post to have that. Thanks for pointing it out.

The idea is that testfile will have the current time/date on it. When you run the find command 1 minute later it will show you only those files that have updated since you created testfile so it should be easy to determine which ones are growing simply by monitoring those.

Note that <directory> could be anything: /var, /, /usr, /usr/local/bin, /usr/lib, /var/log etc...

Thanks for the update!That works fine now. However, . [the current directory] is also included in the result as shown below:

Code:
[root@devarishi ~]# find .  -newer ./test
.
./2
./123
./1
[root@devarishi ~]#

We can exclude the . directory by this method:


Code:
[root@devarishi ~]# find . -newer ./test
.
./c
./hell
[root@devarishi ~]# find . -newer ./test | tail -n +2
./c
./hell
[root@devarishi ~]#
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ZTE MF627 crashes my system continuously! amaj1407 Linux - Hardware 1 09-25-2009 04:51 AM
MySQL ibdata1 growing and growing and growing and... jnojr Linux - Software 1 07-20-2009 07:11 PM
Linpus Fedora after saving files to file system, CAN'T open FILE SYSTEM from desktop! remiwa Fedora 2 01-07-2009 07:28 AM
Suse 10.0 installation problem(System reinstalls continuously) kingkongadp64 SUSE / openSUSE 17 11-07-2005 09:49 PM
Can I find links in the system that point to certain files throughout the system? HGeneAnthony Linux - Newbie 3 02-18-2005 08:28 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:30 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration