Skip to Content
Navigation:

A stick figure smiling

Here's a preview from my zine, Bite Size Command Line!! If you want to see more comics like this, sign up for my saturday comics newsletter or browse more comics!

Image of a comic. To read the full HTML alt text, click "read the transcript". get the zine!
read the transcript!

panel 1:

grep lets you files for text search
$ grep bananas foo.txt

Here are some of my favourite grep command line arguments!

panel 2: -E

Use if you want regexps like “.+” to work. otherwise you need to use “.+”

panel 3: -v

invert match find : all lines that don’t match

panel 4: -r

recursive! Search all the files in a directory.

panel 5: -o

only print the matching part of the line (not the whole line)

panel 6: -i

case insensitive

panel 7:

-A -B -C

Show context for your search
$grep -A 3 foo
will show 3 lines of context after a match

panel 8: -l

only show the filenames of the files that matched

panel 9: -F aka fgrep

don’t treat the match string as a regex
eg $ grep -F...

panel 10: -a

search binaries: treat binary data like it’s text instead of ignoring it!

panel 11: grep alternatives

ack ag ripgrep
(better for searching code!)