Author Login | Popular Articles | RSS Feeds | Sitemap

Home | Computers-and-technology


Linux: Find Files Containing Text

By:

Because of our being forgetful in nature, we oftentimes forget the files that we have created. We can only be fortunate if we can still remember the path, folder, or directory where we have stored those missing files. If that's the case, it would never be a big deal then. However, trully this a big problem and even painful if we can't even remember where we have placed the missing files in our computer. "Simple," I'm hearing you... "find it." Yeah, we can find it. But wait, do you know the filename?

Forgetting files and forgetting the filenames are most common in us. I will never believe somebody out there have a photographic memory and has never experienced missing some of the files he had created before. For sure, we all have gone through that frightening experience especially if the file that is missing is so precious to us.

In Windows, this problem can easily be addressed just by using the find or search tool in the Start menu. Can you remember some texts or phrases in the filename? Use "find files with names" and unleash the power of the wildcard character (*). For example, if you can only remember the word "statistic" in the filename, then search for "*statistic*" and that will search for files with the word "statistic" in the filename. "I can't even remember a word in the filename," again I can hear you saying that. Well, I don't think you can't even remeber even a single word in the file content itself. If you can't remember even a word or phrase in the filename then go for the file content itself. In Windows, still you can search for files containing some texts that you specify in your "find files containing text" input box. That will absolutely solve your problem of forgetting words in the filename itself.

However, if you are in Linux, the whole thing would be more different and complex than it is in Windows especially if you are just a normal user dependent on the GUI interface. Linux is more on executing commands from a shell.

So if you are a normal user and that you are facing the "missing files" problem in Linux, don't worry, I will show you the most common methods in solving this issue:

Find files that contain a text string

grep -lir "text to find" *

The -l switch outputs only the names of files in which the text occurs (instead of each line containing the text), the -i switch ignores the case, and the -r descends into subdirectories.

Find files containing search terms on Ubuntu

To find files containing keywords, linux has a powerful command called grep, which you can use to find the lines inside any file or a list of files.

grep -i -n â€~text to search' *

List files containing text

Used to recursively search a directory for files containing a string, output the names of the files and the line number. This will search all regular files in for .

grep --with-filename --line-number `find -type f`

Article Source: http://www.articlesnatch.com

About the Author:
The author is the owner of one of the most favorite blogs http://smart-pad.blogspot.com.

| Print | Ezine Ready | |

Recent Computers-and-Technology Articles

  • How to Access Facebook From School or at Work By: Gen Wright - For those of you who are not familiar with social networking, you may be wondering what Facebook is all about.
  • In-Home Computer Repair By: Joshep John - In-home computer troubleshooting is facilitated through hundreds of online support resources where you can gather enough knowledge to gain confidence to mend your own PC.
  • Share Files in an Easy and Secured Way By: Jeannie Eden - Internet had enabled various things that were not possible in the earlier times. Now-a-days any work can be done through it.
  • Spy Gear for Nanny Cams and Hidden Cameras By: Chris Bowsers - Spy Gear for Nanny Cams and Hidden Cameras One of the main reasons for using a hidden camera or nanny cam is for the protection...
  • High-End Video Card Options By: Gen Wright - Computer enthusiasts are mostly familiar with video cards that are manufactured for leisure purposes such as gaming or watching movies.
  • High Powered Gaming Moves to Notebook PCs By: Gen Wright - PC games that are resource intensive have been restricted to desktop systems until recently as portable devices were still not powerful enough to allow the...
  • The Basics of Improving PC Performance By: Jonathon Blocker - Like any machine, computers need occasional tweaking to improve their performance and keep them running smoothly.
  • Title Tags - The Key To SEO Success By: Carl Davidson - One of the most important factors in website optimization is your title tag.
  • Buying Tips for Desktop PC By: switch2life - WANT TO BUY A COMPUTER? Having computer today is absolutely a necessity today for your office.
  • New Jersey Computer Repair, Ready To Help 24/7 By: Isabelle Lucas - When you have a computer that is running very slow, making odd noises, or just doesn’t operate as desired, who do you call?

Search Ebay

Still can't find what you are looking for? Search for it!


Submit Your link to the Open Link Directory Project

Copyright 2005-2008 MJE Sales, LLC. All Rights Reserved.
Proud member of the ArticleCkr Search Network Search Network!
ArticleSnatch.com is free for both publishers and authors to use and is supported entirely from advertising revenue.
Use of our service is protected by our Privacy Policy and Terms of Service.