-->

How to extract .gz File in Linux

Author Piyush Gupta
GZ files are archive files compressed with the "gzip" program, similar to zip files. These archive files contain one or more files, compressed into a smaller file size for faster download times from the Internet. Source code and other software program files for Linux are often distributed in .gz or .tar.gz format. Unzip a GZ file using the "gunzip" command or a .tar.gz file using the "tar" command in a Linux terminal.

Command:

$ gunzip archive.gz

Uses:

.gz is files are compressed with gzip in linux. To extract .gz files we use gunzip command.
First use following command to create gzip (.gz) archive of access.log file. Keep remember that below command will remove original file.
gzip access.log
Above command will create a archive file named access.log.gz in current directory.
ls -l access.log.gz
-rw-r--r-- 1 root root 37 Sep 14 04:02 access.log.gz
Now use gunzip command to extract access.log.gz file using command. This will extract the file from archive and remove .gz file automatically.
gunzip access.log.gz

No comments:

Post a Comment