Open In App

zgrep command in Linux with Examples

The zgrep command is used to search out expressions from a given a file even if it is compressed. All the options that applies to the grep command also applies to the zgrep command. 

Syntax:  



zgrep [grep options] Expression File name

Options: 

zgrep -c "linux" GFG.txt.gz



zgrep -i "LINUX" GFG.txt.gz

zgrep -n "linux" GFG.txt.gz

zgrep -v "linux" GFG.txt.gz

zgrep -e "linux" -e "Linux" GFG.txt.gz

zgrep -o "linux" GFG.txt.gz

zgrep -l "linux" *

zgrep -w "linux" GFG.txt.gz

zgrep -h "linux" GFG.txt.gz

Article Tags :