Tech moves fast! Stay ahead of the curve with Techopedia!
Join nearly 200,000 subscribers who receive actionable tech insights from Techopedia.
Grep is a command used in Linux, UNIX and Unix-like operating systems to search text, files or any document for a user-specific pattern, a string of text or a matching character. It displays the matching line on the screen that contains the searched object/objects. Grep is one of the most powerful commands on operating systems like Unix or Linux.
The term grep originates from a command in Unix which used to perform a similar operation, g/re/p, which means "globally search a regular expression and print."
The basic syntax of grep is:
grep [option(s)] pattern [file(s)]
Where the given pattern is searched inside the lines contained in the named files. The objects listed inside the square brackets are optional. When the options and input file are not specified, then the grep command searches for standard input (which is by default the standard text typed on the keyboard) and each line that happens to constitute the given pattern is displayed.