Operating System - HP-UX
1819974 Members
3456 Online
109607 Solutions
New Discussion юеВ

Re: HPUX 11, how to find most recent created file

 
Paul Dutton
New Member

HPUX 11, how to find most recent created file

we are using a HPUX11 system and one of the disks is running out of space all the time, there is a mega structure on this and would take ages to find it, is there a UNIX Command to show on disk what the path and size of recently created files.

Thanks

Paul
11 REPLIES 11
Piergiacomo Perini
Trusted Contributor

Re: HPUX 11, how to find most recent created file

Hi Paul,

maybe you can try this:

touch /newfile
find -type f -newer /newfile -exec ls -l {} \;

Hth
regards
pg
Ivan Krastev
Honored Contributor

Re: HPUX 11, how to find most recent created file

See this mini howto for find command - http://www.softpanorama.org/Tools/Find/find_mini_tutorial.shtml

regards,
ivan
Peter Godron
Honored Contributor

Re: HPUX 11, how to find most recent created file

Hi Paul,
and welcome to the forums !

Please see this earlier thread:
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1037903

ls -lrt would list the files in a directory in reverse time order, but you are after a whole moiunt-pount, so the solution will have to include find.

Please also read:
http://forums1.itrc.hp.com/service/forums/helptips.do?#33 on how to reward any useful answers given to your questions.
Paul Dutton
New Member

Re: HPUX 11, how to find most recent created file

Tried the touch mount point /new file
when i run find MP -type f -newer MP/newfile -exec ls -l{}\;

I get error -exec not terminated with ";"

Please advise

Paul
Peter Godron
Honored Contributor

Re: HPUX 11, how to find most recent created file

Paul,
you need a space between -l and the brackets and a space between brackets and backslash.

ls -l {} \;
^ ^
Paul Dutton
New Member

Re: HPUX 11, how to find most recent created file

Thanks this is a great help, can you advise me on how to pipe this to a file so i can view the output please

Paul
spex
Honored Contributor

Re: HPUX 11, how to find most recent created file

Paul,

This command will display the 10 largest files under /path which were modified less than 3 days ago:

# find /path -type f -mtime -3 -exec ll \+ | sort -rn -k5 | head -n 10

Feel free to experiment with different values until you get a useful result. Note that UNIX has no notion of when a file was created. It is possible to infer this from a file's mtime (last modified timestamp) provided that the file has not be modified since its creation.

PCS

spex
Honored Contributor

Re: HPUX 11, how to find most recent created file

To pipe the find command I supplied in my last message to /tmp/find.out
# find /path -type f -mtime -3 -exec ll \+ | sort -rn -k5 | head -n 10 > /tmp/find.out

Then to read it:
# more /tmp/find.out
Paul Dutton
New Member

Re: HPUX 11, how to find most recent created file

Thanks for your help
Paul
Peter Godron
Honored Contributor

Re: HPUX 11, how to find most recent created file

Paul,
before you close this thread, summarising the solution, could you please read:

http://forums1.itrc.hp.com/service/forums/helptips.do?#28 onwards on how to reward any useful answers given to your questions.
Paul Dutton
New Member

Re: HPUX 11, how to find most recent created file

Thanks for all your help in this,

Job Done

Paul