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
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





Sponsored Links
  #2  
Old
Disabled
 
Join Date: Aug 2006
Posts: 50
Useful for newbie...!!! Good

  #3  
Old
Web Hosting Master
 
Join Date: Jan 2005
Posts: 2,122
thanks, useful

Sponsored Links
  #4  
Old
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 {} \;


  #5  
Old
Local tech for Los Angeles
 
Join Date: Feb 2003
Location: North Hollywood, CA
Posts: 2,541
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


  #6  
Old
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).

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

Reply

Related posts from TheWhir.com
Title Type Date Posted
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
Researchers Urge System Admins to Check for New Apache Web Server Backdoor Malware Web Hosting News 2013-05-01 11:35:53
Big Data and Cloud Drive Enterprise Linux Adoption: Report Web Hosting News 2013-03-27 12:54:34


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?
WHT Host Brief Email:

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

Advertisement:
Web Hosting News:
WHT Membership
WHT Membership



 

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?