To view the contents of a .gz
compressed text file on the screen in Unix or Linux, you can use the cat
command in combination with the gunzip
command.
For example, to view the contents of the file text.txt.gz
, you can use the following command:
gunzip -c text.txt.gz | cat
This will uncompress the contents of text.txt.gz
using gunzip
and pipe the output to the cat
command, which will display the contents of the file on the screen.
You can also use the zcat
command to view the contents of a .gz
compressed text file on the screen. This command is equivalent to gunzip -c
.
For example:
zcat text.txt.gz
This will display the contents of text.txt.gz
on the screen.
Keep in mind that the cat
and zcat
commands will not modify the original .gz
file. If you want to uncompress the file and save the uncompressed version, you can use the gunzip
command without the -c
option.
For example:
gunzip text.txt.gz
This will uncompress text.txt.gz
and save the uncompressed version as text.txt
. The original .gz
file will not be modified.