Solved

Linux, confused about 'find' command

Posted on 2014-01-13
2
385 Views
Last Modified: 2014-01-13
I want to find all occurences of thestring '7' withing all the files of my current directory

How can I do this using the command 'find'

How do I do this by finding all occurences of '7' in the current directory and its subdiirectories ?

Thanks
0
Comment
Question by:Los Angeles1
2 Comments
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 500 total points
ID: 39776834
Do you mean within the content of the files or within the file names?

Names:

find . -type f -name "*7*"

Content:

find . -type f |xargs grep  "7"

Use

find . -type f |xargs grep  -l "7"

to see just the names of the files witch matching content, not the content itself.
0
 
LVL 2

Expert Comment

by:ITTallahassee
ID: 39776835
find -name '*7*'

Open in new window


That will search the current directory and its subdirectories.

http://linux.die.net/man/1/find
0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How many times have you wanted to quickly do the same thing to a list but found yourself typing it again and again? I first figured out a small time saver with the up arrow to recall the last command but that can only get you so far if you have a bi…
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question