O'Reilly logo

LPIC-1/CompTIA Linux+™ Certification All-in-One Exam Guide by Robb Tracy

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Finding Content Within Files

Earlier in this chapter, we discussed shell commands that can be used to search for files in the file system. However, Linux also provides a utility called grep that you can use to search for specific content within a file. The grep utility is extremely useful; in fact, I dare say that most Linux admins use it on a daily basis. Using grep, you can search through a file for a particular text string. This can come in handy when you want to search a very large log file for a specific message or when you need to find a specific directive within a configuration file. You can even use grep to search through multiple files at once to locate a particular expression.

To use grep, you enter grep search_expression file_name ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required