Comments on Linux Gunzip Command Explained with Examples

We have already discussed the gzip command in Linux. For starters, the tool is used to compress or expand files. To uncompress, the command offers a command line option -d. However, there's an entirely different tool that you can use for uncompressing or expanding archives created by gzip. The tool in question is gunzip. In this article, we will discuss the gunzip command using some easy to understand examples.

2 Comment(s)

Add comment

Please register in our forum first to comment.

Comments

By: Mitch

If you've got a buttload of files you want to unzip with a single command like I did, I put together a small looping command for anyone whos interested

for i in *.gz ;do gunzip -c "$i"  > /path/to-output/"${i%.*}"  ; done

 

if you want to ensure it's going to work before actually sending it off, just stick echo in front of gunzip and wrap the command in quotations... like so: for i in *.gz ;do echo " gunzip -c "$i"  > /path/to-output/"${i%.*}" " ; done

That command will just loop through everything in your terminal for you to see what it will be doing without actually executing the command.

 

Hope this helps some! 

By: vyshali

how to gunzip MTN_CUDB_HLR_Data_20220103.tar.gz.gz this file..........how can write shell script to gunzip this file it is having two times .gz.gz,can anyone help me with this?