I tried:

grep "6 0 1 1      0.4154" /media/linux/DATADISK/*

but it does not search in subdirectories of the directory DATADISK.

  • 2
    Welcome to the site. Please do some research and read the documentation... Many commands do not recursively process sub-directories unless explicitly directed to (usually, but not always, a -r or R flag). The documentation (man grep or info grep) should tell you how to do it.
    – C. M.
    Jul 16, 2021 at 12:03
  • Duplicate of How do I grep recursively? and How do I find all files containing specific text on Linux?, the latter having the best answer.
    – Zé Loff
    Jul 16, 2021 at 13:28

1 Answer 1


From grep's man page:

-r, --recursive
          Read all files under each directory, recursively,
          following symbolic links only if they are on the command

So grep -r ... will do the trick. When grepping multiple files I find it useful to also add -H so that the name of the matching file(s) is also printed (this is the default on Linux, but not on other platforms).

  • 1
    You probably want -R not -r since, as you explain, -r will not follow symlinks.
    – terdon
    Jul 16, 2021 at 9:45

Not the answer you're looking for? Browse other questions tagged .