The output of any command acts as a file that can be searched using grep. Using simple search criteria we can find what we want easily.
- Searching within a file on the command line…is very fast and efficient.…For this demonstration,…let's redirect the output of a command to a file.…Type in journal ctl space greater than symbol…journal dot txt.…And hit enter.…This takes the output of the journal ctl command…and saves it in a file named journal dot txt.…To search within this file we use GREP.…GREP stands for General Regulated Expression Parser.…The syntax to GREP is GREP space search criteria space…and then the file name.…
If I want to show all lines in journal dot txt…that included the word kernel…I type in GREP space kernel space journal dot txt…and hit enter.…We can also search from the beginning of a line…or the end of the line by anchoring the search.…If we wanted to find lines that began with…dec we type in GREP space caret…capital DEC space journal dot txt…the caret is the anchor for the beginning of the line.…
And this will only show lines that begin with these letters.…This is just an example.…You might want to change the search criteria…
- Learning Linux command syntax
- Getting help on the CLI and GUI
- Finding help online
- Using basic commands
- Navigating file systems
- Editing text
Skill Level Intermediate
Linux: Bash Shell and Scriptswith Kevin Dankwardt2h 46m Intermediate
Setting up a Red Hat Enterprise Linux Serverwith Sandra Toner2h 46m Intermediate
1. Getting Help
2. Using Basic Commands
3. Navigating File Systems
4. Editing Text
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
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.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.