Linux Terminal Basics: Grep

preview_player
Показать описание
Grep can be used for finding text within a file or output from previous command. You can use Regex with grep (or egrep), which I cover in this video.

Bash Regex Cheatsheet:

Background from Charlie Henson:

Like my channel? Please help support it:

Follow me on Social Media
Рекомендации по теме
Комментарии
Автор

You can also return the lines around the matching line.
grep -A3 pattern filename will include the 3 lines after the match.
grep -B4 " " to include 4 lines before the match.
grep -C2 " " to include 2 lines before and 2 lines after the match.

Inaflap
Автор

I have to just take a moment to say how much I am loving this series. I love learning new things about commands I already knew, and new CLI commands, that can help me in my daily tasks

Xmetalfanx
Автор

Using grep -rn is a real life saver for coders, especially within a large codebase. I've been using it for years.

LinuxSpot
Автор

Knowing Grep turns you from a competent IT guy into a full on hacker. Just need a black hoodie.

ThereIsNoSpoon
Автор

Worth mentioning : -F to search for non regex strings (faster when handling huge files)

nir
Автор

very helpful n precise. Sounds UK or Australian accent.

ParasScorpio
Автор

Please do a tutorial about cmatrix, sl, ddate and xlogo.

jrgenmortensen
Автор

instead of:

$ ps -a | grep

can't you just do:

$ ps -a | egrep ' [0-9] '

or does that not always work?

vincentlantaca
Автор

Why do you hide the window decorations you present on ? I noticed that in your recent videos. Still on KDE Neon ?

firmwaredell
Автор

GNU grep v. BSD grep feels like a missing section of this video. People using a Mac will in some instances have a much different experience without first installing core utils through some 3rd party source. I remember finding that out when I tried `grep -i...` in OS X years ago.

Crux