Linux Quick Tips

Simple and Quick Linux Command Tips

  • About
  • Suggest a Quick Linux Tip

How to Find All Files Not Containing Specific Text on Linux

Question: How do I find all files that do not contain specific text on Linux?

Answer: There could be a number of ways to find files not containing specific text in Linux command line. My favorite way is to use Grep command here.

This is similar to what I did for finding all files containing specific text. You can use the same Grep command with option ‘L’ instead of ‘l’ to achieve this.

grep -RiL "specific_text" <search_directory>
  • R option search recursively in subdirectories and in symbolic links
  • i option is for case-insensitive search
  • L option will print only the name of the files that do not contain the specific text

This will help you find all the files that do not contain the specified string in the given directory and its subdirectories.

Do you use some other way to find all files not matching the string in Linux? Do share it with us in the comment section.

Share this:

  • Twitter
  • Facebook
  • Google
  • Reddit
  • Pocket

Other Linux Command Tips

About Abhishek Prakash

I am a software developer by profession and a Linux user by passion. I also co-founded It's FOSS. Linux Quick Tips is my quick notebook where I share quick Linux command tricks, some basic and some advanced.

Comments

  1. Adam says

    March 21, 2018 at 10:31 am

    Find and Grep can be difficult for beginners.

    Why not try using a GUI tool such as Searchmonkey?

    You can download the latest here:-
    > http://searchmonkey.embeddediq.com

    Or if you are using Ubuntu, try:-
    > sudo apt-get install searchmonkey

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts

  • How to Find All Files Not Containing Specific Text on Linux
  • How to Find and Copy Certain Type of Files in Linux
  • How to Replace All Occurrences of a Word in All Files in Linux Command Line
  • How to Create a Tar File in Linux
  • How to Find IP Address in Linux Command Line



Copyright © 2018 Linux Quick Tips :: Simple and Quick Linux Command Tips