nixCraft Linux Forum

nixCraft

Linux Tech Support Forum

Linux searching for files in the server

This is a discussion on Linux searching for files in the server within the Getting started tutorials forums, part of the Linux Getting Started category; Hello folks. This is my first tutorial. For new Linux sys admin (or user ) like me searching file is ...


Go Back   nixCraft Linux Forum > Linux Getting Started > Getting started tutorials

Register FAQ Members List Calendar Forgotten your password? Mark Forums Read
  #1 (permalink)  
Old 06-17-2006, 03:02 PM
Member
User
 
Join Date: Jun 2005
Posts: 78
Rep Power: 0
jerry
Default Linux searching for files in the server

Hello folks.

This is my first tutorial.

For new Linux sys admin (or user ) like me searching file is a hard task. You can use find command to search any file.

Find command

Syntax
find /path/to/search -name "file-name"

Examples
Search myfile.txt :
Code:
find  / -name "myfile.txt"
Search all .conf (configuration file)
Code:
find  / -name "*.conf" | more
Or send list to /tmp/files.txt
Code:
find  / -name "*.conf" > /tmp/files.txt
Search for files which are writable by anybody:
Code:
find / -perm /220
Search for files in your /etc directory which have been modified in the last 24 hours
Code:
find /etc -mtime 0
Find all *.tmp file and remove all the files:
Code:
find . -type f -name ˜*.tmp" -exec rm '{}' \;
Locate command
Syntax:
locate use to list files in databases that match a pattern.

Find abc.txt file:
Code:
locate abc.txt
Hope this helps.
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 06-20-2006, 06:12 PM
monk's Avatar
Senior Member
User
 
Join Date: Jan 2005
Location: Tibet
My distro: Debian GNU/Linux
Posts: 482
Rep Power: 5
monk will become famous soon enough monk will become famous soon enough
Default

Jerry, quick and dirty work. Keep it up. You can see more find command stuff:

http://www.cyberciti.biz/nixcraft/vi...with-find.html
http://www.cyberciti.biz/faqs/2006/0...s-owned-by.php
http://www.cyberciti.biz/nixcraft/vi...s-based-on.php
http://www.cyberciti.biz/faqs/2006/0...move-files.php
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

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 On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
Searching Tutorial for setup Postfix SMTP-AUTH satimis Mail Servers 0 01-25-2008 09:10 PM
script for FTP'ing 8 differnt server for pulling the files vishal_titre Shell scripting 0 08-17-2007 07:09 PM
script for uploading files to a FTP server marinm Shell scripting 7 01-02-2006 08:35 PM
searching for bad words script marinm Shell scripting 1 02-03-2005 05:32 PM


All times are GMT +5.5. The time now is 01:56 AM.


Powered by vBulletin® Version 3.7.4 - Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36