Linux: Search for text inside files and folders

From SolverBase.com
Jump to: navigation, search

Problem

  • Howto search for text strinf´gs inside files and folders on Linux?
  • System: Linux (Ubuntu, Debian, Mint, Fedora, CentOS, openSUSE, Mandriva, ..)

Solution

  • Open the terminal and then type the following command:
grep "bla-bla" /myfolder/

grep command

  • Use the following command if you want to search in all subfolders too
grep -R "bla-bla" /myfolder/

grep -R

  • Use the following command if you want to search in all subfolders and exclude all binary files
grep -R -I "bla-bla" /myfolder/

grep -R -I