Operating System - HP-UX
1833869 Members
1727 Online
110063 Solutions
New Discussion

Re: how to find out big file in current directory/ and recently updated file

 
AA786
Frequent Advisor

how to find out big file in current directory/ and recently updated file

how to find out big file in current directory/ and recently updated file in HP UX
8 REPLIES 8
Piergiacomo Perini
Trusted Contributor

Re: how to find out big file in current directory/ and recently updated file

Hi arun786,
with
ll|sort -k5,5nr|pg
the largest files will be at the top.

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

you can get recently updated file.

hth
regards
pg
RAC_1
Honored Contributor

Re: how to find out big file in current directory/ and recently updated file

ls -ltr /dir|sort -nk5

Applies to files only.
There is no substitute to HARDWORK
James R. Ferguson
Acclaimed Contributor

Re: how to find out big file in current directory/ and recently updated file

Hi:

To print the name of the most recently modified file in the current directory:

# ls -t|awk 'NR==1 {print $NF}'

To print the largest file in the current directory:

# ls -l|sort -krn5|awk 'NR==1 {print $NF}'

Regards!

...JRF...

AA786
Frequent Advisor

Re: how to find out big file in current directory/ and recently updated file

Thanks .... 1 more

how to (find out big file in current directory/ and recently updated file) in current subdirectory also

Aarun
James R. Ferguson
Acclaimed Contributor

Re: how to find out big file in current directory/ and recently updated file

Hi (again):

Actually, to be correct, we should make sure that we select only files and not subdirectories. It's possible, for instance, that a directory's size might be larger than any of the files in the current directory. You also wanted to see all the attributes of the file found. Hence:

# ls -lt|grep '^-'|awk 'NR==1 {print}'

# ls -l|grep '^-'|sort -krn5|awk 'NR==1 {print}'

Also, as a new member, welcome. Please read:

http://forums1.itrc.hp.com/service/forums/helptips.do?#28

Regards!

...JRF...
Peter Godron
Honored Contributor

Re: how to find out big file in current directory/ and recently updated file

Hi,
probably best if you read this thread and the answers to your same question in Linux forum at:
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1102434

To search subdirectories as well use the suggested find solutions.

Further info can be found via:
man find
man ls

AA786
Frequent Advisor

Re: how to find out big file in current directory/ and recently updated file


thanks every thing works fine

arun
Arturo Galbiati
Esteemed Contributor

Re: how to find out big file in current directory/ and recently updated file

Hi,
using only this command is possbile to select the last updated files,inluding subdir, bigger then 10000 bytes (in this case, but you can chnage this value as you prefer).

ll -trR|awk 'NF==9&&$5>10000'

ll -trR = list files in ricursive way ordering by date in reverse mode (newer first)

NF==9&&$5>10000' = list only files (lines with 9 fileds) and with size (filed5) greater than 10000

HTH,
Art