LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-10-2008, 09:53 PM   #1
swamprat
Member
 
Registered: Sep 2005
Location: New Jersey, USA
Distribution: VMware V12 and V15 in Windows 10, MX Linux 23.1, Kubuntu 23.10, IBM z/VM 5.4
Posts: 558

Rep: Reputation: 34
Find command again.


I want to find the string 'abc' (no quotes) located in any directory or file on the machine.

I've tried: egrep -rl 'abc' /* 2>/dev/null
but this didn't work.

I'm I doing this correctly?

Thanks, Newbi again...
 
Old 11-10-2008, 10:39 PM   #2
nigelc
Member
 
Registered: Oct 2004
Location: Sydney, Australia
Distribution: Mageia 7
Posts: 406
Blog Entries: 4

Rep: Reputation: 80
I tried this, but it seems to be stuck in the /dev directory. if you miss out the "2>/dev/null" just sit & watch it.
 
Old 11-11-2008, 12:33 AM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,363

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Are you looking for 'abc' in a dirname or filename, or do you mean in the contents of a file?

For dirnames & filenames
1. find / -name '*abc*' -print 2>/dev/null

If you want only one of dirs or files, use the -type switch eg

2. find / -type f -name '*abc*' -print 2>/dev/null
3. find / -type d -name '*abc*' -print 2>/dev/null

file contents

4. grep -rHn abc *
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Find/grep command to find matching files, print filename, then print matching content stefanlasiewski Programming 9 06-30-2016 05:30 PM
find and mv command nirmit Linux - Newbie 2 06-27-2008 05:45 AM
find command brazilian_user Linux - General 1 09-12-2006 09:50 AM
find command jch02140 Linux - Newbie 2 07-19-2005 12:21 AM
Find Command chrisk5527 Linux - General 3 04-19-2003 06:26 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:17 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration