UNIX Interview Questions

How to print the file names in a directory that has the word “term”?

grep -l term *
The ‘-l’ option make the grep command to print only the filename without printing the content of the file. As soon as the grep command finds the pattern in a file, it prints the pattern and stops searching other lines in the file.

Leave a Reply