View Compressed files contents without de-compressing them

Good Morning Geeks.

You all should have used the gzip command during your standard RHCE Training or RHCSS Training. Its a very useful command that will compress the file contents. So you save some HDD space, against files those are not in frequent use.

And then on the other side you can use the “gunzip” command to de-compress the file to “view” the contents and use the file.

Now lets suppose you have couple of .gz file and you want to view the contents of the .gz file – w

ithout using gunzip i.e. without de-compressing it.

Can you do this?

YES .. you can. You can use the magical “zcat” command to view the contents of .gz file and once you are satisfied with the contents you can use the same zcat command to redirect the output to the filename of your choice.

Here is a illustrated example from my machine.

“LIKE” = wow

Viewing compressed files with zcat

Viewing compressed files with zcat