0% found this document useful (0 votes)
254 views

Grep Command Cheatsheet

This document provides a cheat sheet for the grep command, listing options such as -i for case insensitive search, -A and -B to show lines before or after a match, -C to show lines around a match, -v to show non-matching lines, and -c to count matching lines. It also lists options like -l to only display file names, -w for exact word matching, -e for regex patterns, -a for binary files, and -r for recursive directory searches.

Uploaded by

hakimsalimi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
254 views

Grep Command Cheatsheet

This document provides a cheat sheet for the grep command, listing options such as -i for case insensitive search, -A and -B to show lines before or after a match, -C to show lines around a match, -v to show non-matching lines, and -c to count matching lines. It also lists options like -l to only display file names, -w for exact word matching, -e for regex patterns, -a for binary files, and -r for recursive directory searches.

Uploaded by

hakimsalimi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

GREP COMMAND CHEATSHEET

i grep -i pattern file Case insensitive search

A grep -A n pattern file Show n lines after the match


B grep -B n pattern file Show n lines before the match

C grep -C n pattern file Show n lines before and after the match

v grep -v pattern file Show lines that do not match

c grep -c pattern file Count number of matching lines

I grep -l pattern file Display only the file names

w grep -w pattern file Match the exact word

e grep -e regex file Match the regex pattern

a grep -a pattern file Search into binary files

r grep -r pattern file Recursively search into directory

Click here for examples

Grep Command in Linux

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy