grep -r
grep -r is a Linux command in the Search & Find category, rated intermediate difficulty. Recursively searches for a pattern in all files under a directory. The syntax is grep -r [options] pattern [path]. It returns matching file paths and lines. A close relative is find, which searches for files and directories in a directory hierarchy. A close relative is locate, which finds files by name using a prebuilt database. Faster than find. A close relative is updatedb, which updates the database used by locate. Run as root periodically. More about this category: Linux search commands — find, locate, which, whereis, and more. Find files and commands on the system. Related Search & Find commands: find, locate, updatedb, which, whereis, type, ack, rg. This page is part of the free Linux Reference documentation covering 304+ commands, each with syntax, options, practical examples, and a difficulty rating.