Unix/Linux Go Back    


UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

Full System Recursive Search for a String - Not Finishing

UNIX for Advanced & Expert Users


Tags
grep, system search

Closed Linux or Unix Question    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 01-03-2013
shorn shorn is offline
Registered User
 
Join Date: Jan 2013
Last Activity: 15 February 2013, 10:33 PM EST
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Unix or Linux Question Full System Recursive Search for a String - Not Finishing

Using
Code:
grep -r -H "foobar" / > result

to give
all files that contain the string "foobar"

Half way , its waiting for some thing and does not end

Not Sure whats happening.
Any help is much appreciated

Thank you
Sponsored Links
    #2  
Old Unix and Linux 01-03-2013
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
 
Join Date: Feb 2004
Last Activity: 3 August 2015, 10:10 PM EDT
Location: NM
Posts: 10,507
Thanks: 347
Thanked 874 Times in 812 Posts

Code:
find / -type f -exec grep  -l foobar {} \;

You have probably hit some character special file that has a readlock on it. You don't want to read tty files anyway. This returns the names of file with the string 'foobar' in them.
Sponsored Links
    #3  
Old Unix and Linux 01-03-2013
shorn shorn is offline
Registered User
 
Join Date: Jan 2013
Last Activity: 15 February 2013, 10:33 PM EST
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
So any way to avoid it hitting files with readlock on it?
There should be some way to successfully search the entire filesystem for a string.

Thanks Again
Sponsored Links
Closed Linux or Unix Question

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Search several string and convert into a single line for each search string using awk command AIX?. laknar Shell Programming and Scripting 5 12-09-2012 06:33 PM
recursive search and copy cabaciucia Shell Programming and Scripting 1 02-02-2012 06:53 AM
how to make a full system backup excluding data and restoring it to a new system pagaille UNIX for Advanced & Expert Users 7 12-13-2010 05:32 PM
Recursive Search and replace only when found string umen Shell Programming and Scripting 1 05-07-2006 01:20 PM



All times are GMT -4. The time now is 07:43 AM.