Quantcast
Viewing all articles
Browse latest Browse all 10

Finding File(s) With Specified Text on Linux

grep command form (syntax)

grep “text string to search” directory-path

Current Directory –>

$ grep "offset" ./*.txt

Directories Recursively –>

Search for a text string all files under each directory, recursively with -r option:
$ grep -r "offset" /home/vhazrati

Only Filenames–>

Pass -H option to print the filename for each match.
$ grep -H -r “offset” /home/vhazrati


Filed under: linux Image may be NSFW.
Clik here to view.
Image may be NSFW.
Clik here to view.

Viewing all articles
Browse latest Browse all 10

Trending Articles