1758377 Members
2683 Online
108868 Solutions
New Discussion юеВ

search question

 
navin
Super Advisor

search question

Hi,
I have a filesystem called /mqsui .I would like to find out a large files in this files ..means the search have to be done recursively.
please help.
the du -sk *| sort -nr only gives dir..level
Learning ...
5 REPLIES 5
Steven Schweda
Honored Contributor

Re: search question

man find

Look for "-size".
R.K. #
Honored Contributor

Re: search question

Hello Navin,

You can use option 'x' instead of 's'in 'du' command.

# du -kx * | sort -nr | head -20 <== for top 20 results

Regds,
R.K.
Don't fix what ain't broke
Dennis Handly
Acclaimed Contributor

Re: search question

>means the search have to be done recursively.

You can use:
find . -type f -exec du -kx {} + | sort -n > sizes_file

If you want to limit it to large files, you can take Steven's -size suggestion:
find . -type f -size +100000c -exec du -kx {} + | sort -n > sizes_file
Ganesan R
Honored Contributor

Re: search question

Hi Navin,

To list first big 25 files

# find /mqsui -xdev -type f -print | xargs ls -an | sort -nr -k 5 | head -25
Best wishes,

Ganesh.
Suraj K Sankari
Honored Contributor

Re: search question

Hi,
If you want to search any specfic size then use the below command

finds files whose size exceeds 100,000 characters.
#find /mqsui -xdev -type f -size +100000c

Suraj