Multiple choice technology operating systems

Which command will search recursively in directories to list the file having a string “file” inside it's content.

  1. grep -l file find . -type f

  2. Find . -type f | grep file

  3. ls -1 | grep file

  4. grep file ls -1

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

The find command recursively locates all files (type f) starting from the current directory, and grep -l searches within each file's content for the string 'file', outputting only filenames that contain a match. Option B incorrectly searches filenames rather than contents, while options C and D only examine the current directory without recursion.