grep
The grep
command searches the given file for lines containing a match to the given strings or words. As an example, search ‘./package.json‘ for ‘gatsby-plugin-twitter‘:
$ export GREP_COLOR='1;37;41'
$ grep --color='auto' gatsby-plugin-twitter package.json
"gatsby-plugin-twitter": "^2.1.2",
To search through all the files and directories for a given string such as ‘gatsby-plugin-twitter’, pass the -r
(or --recursive
) flag:
$ export GREP_COLOR='1;37;41'
$ grep -r --color='auto' 'gatsby-plugin-twitter' /tmp
/tmp/package.json: "gatsby-plugin-twitter": "^2.1.2",