Jeremy's Notes

The Reverie of a Techie


What is this thing?

You've stumbled across a blog that chronicles the interests of its author. You'll find technology how-tos, demonstrations, recommendations, and reviews. Stand by!

Follow me on Twitter, Facebook, and other social networks.

Welcome to Jeremy's Notes

Jeremy's Notes provides a first-hand experience of setting up, living in and maintaining a smart home. Jeremy shares his professional and personal experiences in and around the IT world, which he integrates into many aspects of his home and life.

How to find files containing specific text in Linux?

Penguin by Lars Meiertoberens from the Noun Project If you would like to find a specific string of text within a directory of files, you can use the following command and example:

user@host:~$ grep -rnw '/path/to/directory/' -e 'searchterm'

Here's a breakdown of the example command and its parameters:

  • -r or -R will recursively (within directories) look at all files within the specified path.
  • -n will display the line number where the term shows up within each file.
  • -w Matches the whole word.

→

2023/04/09 16:18 · jmac · 40 Comments
This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
start.txt · Last modified: 2023/04/16 13:11 by