bzgrep command in Linux with examples

bzgrep is a Linux command used to search for a pattern or an expression but inside a bzip2-compressed file. This command simply passes it’s arguments and the decompressed files to grep. Therefore, all the flags used in the grep command remain same in bzgrep, since they are simply sent to grep as they are. If no file is specified, then the standard input is decompressed if necessary and fed to grep.

Synopsis:

bzgrep [ grep_options ] [ -e ] pattern filename...

Example: Here we take a normal text file, use grep on it. Then we compress it using bzip2 and search the specific pattern in the compressed file with bzgrep.



My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.