zgrep command in Linux with Examples Last Updated : 19 Jul, 2024 Comments Improve Suggest changes Like Article Like Report 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 nameOptions: -c : This option is used to display the number of matching lines for each file. Example: zgrep -c "linux" GFG.txt.gz-i : This option is used to ignore case sensitivity. Example: zgrep -i "LINUX" GFG.txt.gz-n : This option is used to display the line number of file if the given expression is present in the line. Example: zgrep -n "linux" GFG.txt.gz-v : This option is used to display the lines which doesn't have the expression present in it. Basically invert the search function. Example: zgrep -v "linux" GFG.txt.gz-e : This option is used to specify the expression but can be used multiple times. Example: zgrep -e "linux" -e "Linux" GFG.txt.gz-o : This option is used to display only the matched section of the line from the given expression. Example: zgrep -o "linux" GFG.txt.gz-l : This option is used to display the names of the files with the expression present in it. Example: zgrep -l "linux" *-w : By default, zgrep command displays lines even if the expression is found as a sub-string. This option only displays lines only if the whole expression is found. Example: zgrep -w "linux" GFG.txt.gz-h : This option is used to display the matched lines but doesn't display the file names. Example: zgrep -h "linux" GFG.txt.gz Comment More infoAdvertise with us Next Article zgrep command in Linux with Examples B basilmohamed Follow Improve Article Tags : Linux-Unix linux-command Linux-file-commands Similar Reads How to Display the current Username in Linux | whoami Command Imagine you're working on your computer and forget who you're logged in as. In Linux, there's a special trick called "whoami" that's like asking "Hey computer, who am I right now?" This article explains how this simple command works and helps you remember who's in charge! Don't worry, it won't be fu 4 min read write command in Linux with Examples The `write` command in Linux facilitates the users in sending the messages directly to other logged-in users' terminals. For using this command, try on to type `write username` and then type your message. After typing your message, press `Ctrl+D` to end the session. This command is useful for quick 6 min read xargs command in Linux with examples xargs is a Unix command which can be used to build and execute commands from standard input. Importance:Some commands like grep can accept input as parameters, but some commands accept arguments, this is a place where xargs came into the picture. Syntax of `xargs` command in Linuxxargs [options] [co 5 min read xdg-open command in Linux with Examples xdg-open command in the Linux system is used to open a file or URL in the userâs preferred application. The URL will be opened in the userâs preferred web browser if a URL is provided. The file will be opened in the preferred application for files of that type if a file is provided. xdg-open support 2 min read yes command in Linux with Examples yes, the command in Linux is used to print a continuous output stream of a given STRING. If STRING is not mentioned then it prints 'y'; Syntax: of `yes` command in Linuxyes [STRING] Note: To stop printing please press Ctrl + C. Use of `yes` commandlet us say that we want to delete all the `.txt` fil 2 min read zdiff command in Linux with Examples The zdiff command in Linux is used to invoke the diff program on files compressed via gzip. All options specified are passed directly to diff. By utilizing "zdiff," you can easily analyze differences between compressed files without the need to decompress them beforehand. Important Points:If only on 2 min read zdump command in Linux with Examples The zdump command in Linux is a valuable tool used to display the current time in various time zones. This command outputs the local time for each specified timezone, making it useful for developers, system administrators, or anyone working with multiple time zones. It also helps in analyzing time z 3 min read 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 nameOptions: -c : This option is used to display the number of matching 3 min read ZIP command in Linux with examples In Linux, the zip command compresses one or more files or directories into a single.zip archive file. This saves disk space, keeps data organized, and makes it simple to share or backup files. It's among the most used compression utilities, particularly when sharing large files via email or storing 6 min read Like