hosted by liquidweb


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

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
  #1  
Old 06-03-2006, 06:08 AM
manuel_accu manuel_accu is offline
Disabled
 
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



Reply With Quote


Sponsored Links
  #2  
Old 08-18-2006, 10:01 AM
sysconfig sysconfig is offline
Disabled
 
Join Date: Aug 2006
Posts: 50
Useful for newbie...!!! Good

Reply With Quote
  #3  
Old 08-20-2006, 01:40 AM
HD Fanatic HD Fanatic is offline
Web Hosting Master
 
Join Date: Jan 2005
Posts: 2,099
thanks, useful

Reply With Quote
Sponsored Links
  #4  
Old 08-24-2006, 03:53 PM
tamar tamar is offline
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 {} \;


Reply With Quote
  #5  
Old 10-15-2006, 04:24 AM
Jeremy Jeremy is offline
Local tech for Los Angeles
 
Join Date: Feb 2003
Location: North Hollywood, CA
Posts: 2,539
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 >> http://webcp.hostinghacks.net/redhat/secure-compilers/

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

(310) 573-8050 - LinkedIn


Reply With Quote
  #6  
Old 10-18-2006, 09:47 AM
opera.mp3 opera.mp3 is offline
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).

Reply With Quote
  #7  
Old 11-05-2006, 08:14 PM
Al3in Al3in is offline
New Member
 
Join Date: Jun 2006
Posts: 2
thank you very much dear .......

Reply With Quote
Reply

Related posts from TheWhir.com
Title Type Date Posted
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
Big Data and Cloud Drive Enterprise Linux Adoption: Report Web Hosting News 2013-03-27 12:54:34
Web Host Certified Hosting Launches New Linux VPS Plans Web Hosting News 2012-08-22 09:08:38
Web Host MochaHost Adds New Features to Linux VPS Hosting Plans Web Hosting News 2012-08-01 15:52:14


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
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com 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?