Thread: Help!
View Single Post
  #6 (permalink)  
Old 10-02-09, 11:09
kitaman kitaman is offline
Papabi's friend
 
Join Date: Sep 2009
Location: Ontario
Posts: 626
The ~ symbol is shorthand for "my home directory", and the + sign does add "greater than" to the meaning of what follows for the size option on the find command.

"find ~ " will search your home directory only, the problem with only looking there is that all users have write access to /tmp and possibly /u or /public, and also unread mail (/var/spool/mail)

The following script will list files for each regular (those with uid >199) user.
It must be run by root to be effective.

!#/bin/sh
#$1 is size of file to search for input should look like 5000000c or 5M,
# use "man find" to determine the possible values for -size
IFS=":"
while read user x uid filler
do
if [ $uid -gt 199 ]
then
echo Files owned by $user greater than $1
find / -size +$1 -user $user -exec ls -l {} \;
echo "\n"
fi
done </etc/passwd
Reply With Quote