hosted by liquidweb

Go Back   Web Hosting Talk : Web Hosting Main Forums : Web Hosting Talk Tutorials : Hosting Security and Technology Tutorials : Find command : Linux

Forum Jump

Find command : Linux

Reply Post New Thread In Hosting Security and Technology Tutorials Subscription
Send news tip View All Posts Thread Tools Search this Thread Display Modes
Join Date: Jun 2006
Posts: 0

Find command : Linux

Sometimes we need to find the file in server which we do not know where exactly it is located:

·Search and list all files from current directory and down for the string ABC:

find ./ -name "*" -exec grep -H ABC {} \;
find ./ -type f -print | xargs grep -H "ABC" /dev/null
egrep -r ABC *

·Find all files of a given type from current directory on down:

find ./ -name "*.conf" –print

·Find all user files larger than 5Mb:

find /home -size +5000000c –print

·Find all files owned by a user (defined by user id number) on
the system: (could take a long time)

find / -user 501 –print

·Find all files created or updated in the last five minutes: (Great for finding effects of make install)

find / -cmin -5

·Find all world writable directories:

find / -perm -0002 -type d –print

·Find all world writable files:

find / -perm -0002 -type f -print
find / -perm -2 ! -type l -ls

·Find files with no user:

find / -nouser -o -nogroup –print

·Find files modified in the last two days:

find / -mtime 2 -o -ctime 2

Sponsored Links
Join Date: Aug 2006
Posts: 50
Useful for newbie...!!! Good

Web Hosting Master
Join Date: Jan 2005
Posts: 2,166
thanks, useful

Sponsored Links
Junior Guru
Join Date: May 2006
Posts: 232
Great stuff. The find command is extremely powerful and has so many excellent uses.

You might want to consider showing how you can apply immediate changes (using exec) to the results of a find. Of course, all that is to be used at one's own risk -- but that's what I find most practical about the command.

Here's one practical use - finding files in a directory that are older than 3 days and deleting them:

# find /directoryname -type f -mtime +3 -exec rm {} \;

Local tech for Los Angeles
Join Date: Feb 2003
Location: North Hollywood, CA
Posts: 2,548
Applications that have the suid bit set can masquerade as one user,
possibly a very powerful one such as root, and yet can be run
by regular users. You should review what programs have
suid bit set and decide if it is appropriate.
The following command will provide a list of SUID/SGID programs.

find / -type f \( -perm -04000 -o -perm -02000 \) \-exec ls -l {} \;

from >>

Remote Hands and Your Local Tech for the Los Angeles area.

(310) 573-8050 - LinkedIn

Junior Guru Wannabe
Join Date: Jul 2005
Posts: 56
it can be occasionally useful in fixing certain file permissions
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;

an example scenario would be you accidentally recursively chmod'd to 644 yet forgot there were a lot of folders in that directory. or, you copy files from a location that has the permissions all screwed up (from a CD or a zip/tar file, etc).

New Member
Join Date: Jun 2006
Posts: 2
thank you very much dear .......


Related posts from
Title Type Date Posted
Docker Buys Kitematic, a Startup Focused on Making it Easy to Run Docker on Macs Web Hosting News 2015-03-12 09:10:10
SCALE 13x, the Southern California Linux Expo Web Hosting Events 2015-02-24 09:57:58
Hackers Use Enterprise Linux Systems in Botnet DDoS Attacks: Prolexic Research Web Hosting News 2014-09-04 11:22:30
Linode Releases CLI Tool for Cloud Platform Web Hosting News 2014-01-29 17:15:43
Linux Kernel 3.10 Sees Most Developer Contributions Ever Web Hosting News 2013-09-16 13:17:24

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump
Log in with your username and password

Forgot Password?
WHT Host Brief Email:

We respect your privacy. We will never sell, rent, or give away your address to any outside party, ever.

Web Hosting News:
WHT Membership
WHT Membership



Welcome to

Create your username to jump into the discussion! is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.

(4 digit year)

Already a member?