Join Scott Simpson for an in-depth discussion in this video Search for text in files and streams with grep, part of Learning Linux Command Line.
- [Voiceover] One of the main reasons…we'd want to take a look at text files,…is to find some particular piece of information.…One tool you can use to do that is grep.…I just want to show you the basics here,…because you could spend hours…digging into all the powerful stuff grep can do.…At its most basic, grep prints lines of text…that match a pattern.…Sounds simple, right?…Well, a lot of the time it is.…I can use grep to search for a word…or phrase, which is really helpful…in going through configuration files or log files.…Or in our case, a poem.…
Let's have grep show us all the lines…of our poem's file that have the letters T, H, E.…To do this, I'll write grep,…and then the search term in quotes, "the,"…and then the name of the file I want to use.…And I can see in the results my search term…is highlighted.…And only lines of the file which contain that term…are shown on the screen.…To illustrate this a little bit better,…I'll run the same command again,…but add the -n option,…which numbers the output lines,…so we can see which lines of the original file…
This course will establish the foundation for more advanced Linux topics. Find other Linux training courses here.
- What is the Linux command line?
- Writing Linux commands at the prompt
- Finding help for Linux commands
- Editing files and folders
- Configuring user roles and file permissions
- Using pipes to connect commands
- Peeking at files
- Searching and editing text
- Finding disk and system information
- Installing and updating software
Skill Level Beginner
1. Command-Line Basics
2. Files, Folders, and Permissions
3. Common Command-Line Tasks and Tools
4. A Peek at Some More Advanced Topics
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.