How to use the Linux or UNIX command line to decompress gzip files.
Method for .gz files
Use the following method to decompress gzip files from the command line:
- Use SSH to connect to your server.
- Enter one of the following:
- gunzip file.gz
- gzip -d file.gz
- To see the decompressed file, enter:ls -1
Method for tar.gz and .tgz files
Files with the extension tar.gz or .tgz represent tar files compressed with gzip. Observe the following procedure to decompress these files from the Linux command line:
Use SSH to connect to your server.
For tar.gz files, enter:
gunzip < file.tar.gz | tar xvf -
For .tgz files, enter:
gunzip < file.tgz | tar xvf -
If you use the GNU operating system also known as GNU Tar, use one of the following commands, depending on whether the file uses the tar.gz or .tgz extension:
tar xvzf file.tar.gz
tar xvzf file.tgz