Search for a particular file in the server | Unix Linux Forums | Shell Programming and Scripting

  Go Back    


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

Search for a particular file in the server

Shell Programming and Scripting


Tags
shell script, shell scripting, unix scripting, unix scripting basics

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 12-09-2008
venkidhadha venkidhadha is offline
Registered User
 
Join Date: Aug 2008
Last Activity: 6 August 2014, 1:32 PM EDT
Posts: 29
Thanks: 3
Thanked 0 Times in 0 Posts
Search for a particular file in the server

I need to search for a particular file pattern in the whole server. In windows we just get into start and then click on search and find the file.

How will search for the particular pattern of file in the whole server. let me know about it.
I tried using the find command will that help or is there any other command which willhelp this purpose.
Sponsored Links
    #2  
Old 12-09-2008
zaxxon's Avatar
zaxxon zaxxon is offline Forum Staff  
code tag tagger
 
Join Date: Sep 2007
Last Activity: 23 October 2014, 4:00 AM EDT
Location: St. Gallen, Switzerland
Posts: 6,235
Thanks: 121
Thanked 453 Times in 412 Posts
find was a good idea. You could just test it by searching a file you know it exist.

Code:
find / -type f -name "yourfilename" -print

Sponsored Links
    #3  
Old 12-09-2008
iamgeethuj iamgeethuj is offline
Registered User
 
Join Date: Apr 2008
Last Activity: 5 November 2009, 6:40 AM EST
Posts: 38
Thanks: 0
Thanked 0 Times in 0 Posts
Could u plz give me an example?
    #4  
Old 12-09-2008
venkidhadha venkidhadha is offline
Registered User
 
Join Date: Aug 2008
Last Activity: 6 August 2014, 1:32 PM EDT
Posts: 29
Thanks: 3
Thanked 0 Times in 0 Posts
For Example if my file patter is abc.lvc.* Can you let me know how i can implement the command for this ?
Sponsored Links
    #5  
Old 12-09-2008
joeyg's Avatar
joeyg joeyg is offline Forum Staff  
modérateur
 
Join Date: Dec 2007
Last Activity: 21 October 2014, 10:08 AM EDT
Location: Out running a Marathon.
Posts: 2,332
Thanks: 73
Thanked 155 Times in 144 Posts
Tools Format(s)


Code:
find . -name abc.lvc.* -print

Will find files from you current directory and all sub-directories beneath it.


Code:
find / -name abc.lvc.* -print

Will search the entire system for the files. Will take a while, and you may see errors that you do not have access to view directories.

Last edited by joeyg; 12-09-2008 at 11:06 AM..
Sponsored Links
    #6  
Old 12-09-2008
venkidhadha venkidhadha is offline
Registered User
 
Join Date: Aug 2008
Last Activity: 6 August 2014, 1:32 PM EDT
Posts: 29
Thanks: 3
Thanked 0 Times in 0 Posts
Thanks.
Sponsored Links
    #7  
Old 12-09-2008
methyl methyl is offline Forum Advisor  
Advisor
 
Join Date: Mar 2008
Last Activity: 18 April 2014, 5:13 AM EDT
Posts: 6,396
Thanks: 287
Thanked 673 Times in 642 Posts
In unix but not Windows a fullstop can mean any character or characters. It needs to be escaped with a preceding back solidus. Also you want asterisk expanded by find and not by shell.
If directories are linked at root level you will need "//" rather than "/".

find // -name abc\.lvc\.\* -print
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
sed help - search/copy from one file and search/paste to another ncwxpanther Shell Programming and Scripting 5 08-21-2011 10:56 AM
preserving the timestamp of a file when copied from remote server to local server using ftp arunkumarmc Shell Programming and Scripting 5 05-14-2010 05:18 AM
Copying dir (and sub dir) file names from ftp server to txt file in diff server deking UNIX for Dummies Questions & Answers 1 12-23-2009 11:07 AM
use ind command to search files on differnet server vikash_k Shell Programming and Scripting 1 07-08-2009 06:30 AM
Transfer file from local unix server to remote server indira HP-UX 2 05-02-2007 05:15 PM



All times are GMT -4. The time now is 09:45 AM.