Operating System - HP-UX
1753797 Members
8474 Online
108805 Solutions
New Discussion юеВ

How to list the files being modified now in a particular direcotory

 
SOLVED
Go to solution
Din_1
Frequent Advisor

How to list the files being modified now in a particular direcotory

Hi all,

Mine is HP-UX 11.23 IA64 server. I need to find the list of files, which is being modified currently in a particular direcotory.
Is there any command to get the output for this?

Regards,
Din
13 REPLIES 13
Johnson Punniyalingam
Honored Contributor

Re: How to list the files being modified now in a particular direcotory

ls -lrt
Problems are common to all, but attitude makes the difference
Johnson Punniyalingam
Honored Contributor

Re: How to list the files being modified now in a particular direcotory

lsof "man lsof"
Problems are common to all, but attitude makes the difference
Din_1
Frequent Advisor

Re: How to list the files being modified now in a particular direcotory

Hi Jhonson,

Thanks for your reply, I forgot to mention a point. I need to find the files in that directory along with that sub direcotories.

Thanks,
Din
James R. Ferguson
Acclaimed Contributor

Re: How to list the files being modified now in a particular direcotory

Hi Din:

Use 'find' and define what you mean when you say "modified currently". For example:

# cd

# find . -xdev -type f -mtime 0

...would list *files* in the current directory ('.') and not cross mountpoints ('-xdev') and list the names of the files modified during the last 24-hours ('-mtime 0').

If you want to find files modified *since* a time you can do:

# cd
# touch -mt 10250000 /var/tmp/myref
# find . -xdev -type f -newer /var/tmp/myref

...which would find all files modified after 0000 hours on October 25.

See the manpages for 'find' and 'touch' for more information.

Regards!

...JRF...
Din_1
Frequent Advisor

Re: How to list the files being modified now in a particular direcotory

Hi James,

Thanks for your reply. I have a file system called /testarch. This file system grows more than 85% frequently. So whenever this filesystem goes more than this benchmark i need to find the growing files under this direcotory and its subdirecotory.

Thanks,
Din
Johnson Punniyalingam
Honored Contributor

Re: How to list the files being modified now in a particular direcotory

ls -lRt

-R
lists subdirectories recursively.

-t
sorts entries by time. By default, this option sorts the output by the modification times of files.

Please help to man ls " you find more"

Rgds,
Johnson
Problems are common to all, but attitude makes the difference
Johnson Punniyalingam
Honored Contributor

Re: How to list the files being modified now in a particular direcotory

Hi Din,

the below command will help you find some large file under your mount point /testarch

find -xdev -type f -size +5000000c -exec ls -ld {} \; | sort -nk 5

after you find if you would like to house keep you can gzip / rm those files

schedule cron -job some thing like house keeping scripts

Rgds,
Johnson
Problems are common to all, but attitude makes the difference
Johnson Punniyalingam
Honored Contributor

Re: How to list the files being modified now in a particular direcotory

Hi Din,

One more thing you can automate "script" which will send File system email alert :)

bdf | awk 'z[split($5,z,"%")-1]>70' | elm -s "Filesystem > 70%" xxx@xxx.xxx

if you have mail service configured

Thanks,
Best Regards,
Johnson
Problems are common to all, but attitude makes the difference
Din_1
Frequent Advisor

Re: How to list the files being modified now in a particular direcotory

Hi Jhonson,

Thanks for your reply. To get the large size file in a particular directory i can use the following command.

find /testarch | xargs ll -ld | sort -nrk5 | more

My requirement now is, i need to find a file which is growing without any limits in a particular file system.

Let's assueme /var filesystem is about to reach 100%. I need to find a particular file which is causing this effect.

Let's assume /var/adm/file1 is growing without any limit. I need to find this file1, and stop this growing further to avoid 100% of filesystem.

Hope you got my point.

Regards,
Din