1828366 Members
2855 Online
109976 Solutions
New Discussion

Re: find command

 
SOLVED
Go to solution
Chern Jian Leaw
Regular Advisor

find command

I had used find to search for user home directories having quota their quota > 40MB, in their home dirs in /usr/eng/cadeng:

/usr/eng/cadeng/joe_bloggs
/usr/eng/cadeng/willy_hacker

I did the following under /usr/eng:
# find . -type /cadeng/willy_hacker -size +40000k

Unfortunately, it did not print anything.

I had also tried the following under /usr/eng/cadeng
#find . -size +40000k

which only searches for individual files under a directorty exceeding 40MB.

I also tried :
#find . -type -d willy_hacker -size +40000k which produced:
find: 0652-009 There is a missing conjunction error

Could someone help me on this?

Thanks.
2 REPLIES 2
Martin Burnett_2
Trusted Contributor

Re: find command

Hello Chern,

I used the following:

[root@penguin /root]# find / -size +4000k -print
/usr/lib/rpmdb/i386-redhat-linux/redhat/Basenames
/usr/lib/rpmdb/i386-redhat-linux/redhat/Packages
/usr/lib/libgcj.so.1.0.0
/usr/lib/libgcj.a
/usr/lib/libc.a
/usr/lib/netscape/netscape-communicator
/usr/lib/qt-2.3.0/lib/libqt-mt.so.2.3.0
/usr/lib/qt-2.3.0/lib/libqt.so.2.3.0
/usr/bin/gs
/usr/X11R6/lib/libMagick.a
/var/lib/rpm/Packages
/var/lib/rpm/Basenames
/proc/kcore
/lib/i686/libc-2.2.2.so

That seems to work just fine.

Thanks for participating in the forums,

Martin
Chaos reigns within. Reflect, repent, and reboot. Order shall return.

Stuart Browne
Honored Contributor
Solution

Re: find command

Ok, lets see if I can get this straight.

You're not looking for an individual file which is greater than 40Mb, correct? You're looking for a directory structure?

If so, 'find' won't tally up the contents of a drectory and give you a total. For that, you use the 'du' command.

cd /usr/eng/cardeng
du -x -k --max-depth=1

Whilst this won't just show directires that have greater than 40Mb, it will show the sum total of the directory structures under that tree. It'd print out somehting like:

2038 ./joe_bloggs
40283 ./willie_hacker

Beyond that, standard text-parsing tools would help you (| awk '{if ($1 > 40000) {print}}') or some such.

If you are implementing 'quota's on the filesystem, then the Quota tools should also be able to help you.
One long-haired git at your service...