Operating System - HP-UX
1827593 Members
2707 Online
109965 Solutions
New Discussion

Re: Easy points for all...

 
SOLVED
Go to solution

Easy points for all...

Hi. All!

Excuse me but I can't "find"
files with some size.:(
I type below:
#find . -size c1000000
and get:
./.dt/sessions/current/dt.session
./.dt/Trash/files.err
./.dt/.Printers/Hardcopy_Print
./.dt/.Printers/Line_Print
./.dt/.Printers/List_Print
./.dt/.Printers/OnlineB_Print
./.dt/.Printers/Postscript_Print
./.dt/.Printers/Printer1_Print
./.dt/.Printers/Printer2_Print

Where is a mistake?
(I need to find files with some size)
Thanx in advance. Oleg
12 REPLIES 12
Paula J Frazer-Campbell
Honored Contributor

Re: Easy points for all...

HI

find . -size +1000000c -exec ls -l {} \;

Will do it.
Change size to suit.


Paula
If you can spell SysAdmin then you is one - anon
Robin Wakefield
Honored Contributor
Solution

Re: Easy points for all...

Hi Oleg,

Nearly correct:

find . -size +1000000c | xargs ll -d

Rgds, Robin.
Michael Tully
Honored Contributor

Re: Easy points for all...

Hi Oleg,

try this:

find . -size +1000000c | xargs ll

HTH
-Michael
Anyone for a Mutiny ?

Re: Easy points for all...

Hi!
Sorri but in case:
#find . -size +1000000c -exec ls -l {} \;
I got nothing. :(

In case:
#find . -size +1000000c | xargs ll
I got list of files of folder with sizes. Size - any.

Whats up?

Thanx.Oleg


Re: Easy points for all...

Hi!
Sorri but in case:
#find . -size +1000000c -exec ls -l {} \;
I got nothing. :(

In case:
#find . -size +1000000c | xargs ll
I got list of files of folder with sizes. Size - any.

Whats up?

Thanx.Oleg
P.S. Sorry what in "databases"...


Robin Wakefield
Honored Contributor

Re: Easy points for all...

Hi Oleg,

This indicates that you have no files greater than 1000000 bytes within your current directory.

Don't forget to use "xargs ll -d", NOT "xargs ll". Try reducing the number down if you want to see some output.

find . -size +500000c | xargs ll -d

Rgds, Robin
Andreas Voss
Honored Contributor

Re: Easy points for all...

Hi,

when you do:

find . -size +1000000
it searches for files greater then 1000000 Bytes (1MB)
If you only whant to list files not dirs use:
find . -type f -size +1000000c

Regards

Re: Easy points for all...

Hi!
It is a shame to me...
I has mixed "/- root folder" - and ". - current folder" and I found files with sizes >1 Mb where isnt.
Excuse me. ITS WORK!!
Thanx all.
But I'm interesting - what to do command:
find . -size +1000000c -exec ls -l {} \;

Oleg.
Santosh Nair_1
Honored Contributor

Re: Easy points for all...

Not sure what you're asking...if you're asking what this command does, then, the find portion finds files starting in the present directory (.) that is larger than 1000000 characters (size +1000000c) and then executes the ls -l command on these files (-exec ls -l {}). I would also check to see if this is a file (-type f).

-Santosh
Life is what's happening while you're busy making other plans
Robin Wakefield
Honored Contributor

Re: Easy points for all...

Hi,

One point to remember. When you ask find to process a lot of files, the "xargs" method is a lot more efficient, because it will collect the filenames as multiple arguments within one command (or as many as will fit per line). "-exec" will spawn one process per file.

Rgds, Robin.

Bill Hassell
Honored Contributor

Re: Easy points for all...

Before you go looking for large files, you should always start by looking for big directories. Big directories are more important since they may not contain big files but instead, contain hundreds or thousands of smaller files and they may need to be purged. Use this:

du -kx . | sort -rn > /tmp/du.root

Now the largest directories will be at the top. Note that the root filesystem must have only 3 big directories: /sbin /etc /dev. Any other big directory is in the wrong place and must be moved. And /dev should be less than 100, typically less than 50. If it is very large, there is a mistake, usually a misspelled device file such as /dev/rmt/om rather than 0m.

Now / may be your root's $HOME directory in which case, root's home may contain a lot of unnecessary files. To make things easier to identify and to remove the possibility of a mistake using rm, move root's $HOME to another directory, perhaps /root.


Bill Hassell, sysadmin

Re: Easy points for all...

To Paula
Excuse me for small points - your message was useful and late answer - my internet traffic has been low. :(
How I can "to compensate" it?

Oleg