Grep .gz files on linux

I was looking to a method to search a lot of .gz files through. It was some logfiles, you can use zgrep to do this.
Example:
zgrep ‘Search word’ /path/to/yours.gz

So I do this to search a lot of gz files through:
Zgrep ‘130.226.165.XXX’ /var/log/apache2/access*.gz

If you just want to cat a single gz file, you can use zcat.
Zcat /var/log/apache2/access.log.52.gz

Leave a Reply

Your email address will not be published. Required fields are marked *