• Skip to primary navigation
  • Skip to main content
sharadchhetri

sharadchhetri

Tutorials On Linux, Unix & Open Source

  • Home
  • Linux Commands
  • Resources
    • Learn Linux
  • My WordPress plugins

find command to search keyword in files recursively in linux

June 19, 2013 by Sharad Chhetri Leave a Comment

find command to search keyword in files recursively in linux
Find command is one of the system command which is useful to search files and directory.
It has many used and you can modify your search by using -exec flag. Here I am using exec with grep command.

By below given command you can find the keyword in files in linux system.
(Replace the “keyword” with your searching word)

Here below given flags with grep command have these features
-l will only show file name
-w will look for exact same keyword

Find more keywords by typing command “grep –help”


find / -type f -exec grep "keyword" {} +

or 

find / -type f -exec grep -l "keyword" {} +

eg.

For Exact Pattern of keyword

find / -type f -exec grep -w "keyword" {} +

OR 

find / -type f -exec grep -w -l "keyword" {} +

Share this:

  • Twitter
  • Facebook
  • More
  • Print
  • Email
  • LinkedIn
  • Reddit
  • Tumblr
  • Pinterest
  • Pocket
  • Telegram
  • WhatsApp
  • Mastodon

Related posts:

  1. Search Keyword In Man Page Like We Search In vi / vim Editor
  2. rsync all files,hidden files,symlinks,hardlinks to remotes Linux Server
  3. search keyword in file with line number using grep command
  4. Search keyword in all available man pages – man command
  5. awk command to search keyword or strings in file
  6. linux command to list the files from rpm package without extracting
  7. How to use grep command to get fixed pattern or exact keyword
  8. How to rename and move the directory and files in linux
  9. list files and directories by 4 commands in linux
  10. Extract single and selected files from RPM package on Linux

Filed Under: Linux, Tips And Tricks Tagged With: find

Reader Interactions

Leave a Reply Cancel reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Copyright © 2023 ยท
The material in this site cannot be republished either online or offline, without our permission.
Proudly Blogging From Bharat.

  • Contact
  • About Me
  • My WordPress plugins
  • Privacy Policy