How to unzip gz file in linux

 

How to unzip gz file in linux
 

We know that a file on a computer system can be as small as a few bytes or as large as a thousand gigabytes. When you want to pass a file from one end to the other, its size plays a very important role when you decide to send it as is or compress it. The archivo.gz format is a compressed file format very commonly used for the Linux operating system. Today we will explore the methods of extracting and opening a archivo.gz in the Linux operating system. GZ files are compressed archives with the program “gzip”, similar to zip files. These files contain one or more files, compressed into a smaller file size to speed up download times on the Internet. Source code and other software files for Linux are often distributed in formato.gz or.tar.gz. Unzip a GZ file using the “gunzip” command or a archivo.tar.gz file using the “tar” command on a Linux terminal.

Methods to extract and open a archivo / unzip .gz in Linux Command:


     There are several different methods in which we can access, extract and open an archivo .gz on Linux. We have listed all these methods below:

Method 1:

Use the command “gzip” with the “-d” flag: This method is useful when you want to extract the actual file when deleting the archivo.gz file. To use the command “gzip” with the “-d” flag, you need to perform the following steps: To demonstrate the first three methods, we will first create a archivo .gz in our main directory by running the following command in our terminal:

 Use SSH to connect to your server.

2-    Enter one of the following:

3-    To see the decompressed file, enter:


 Method 2:


Use the command “gzip” with the “-dk” flag: This method is useful when you want to extract the actual file while keeping the archivo.gz also for future use. To use the command “gzip” with the “-dk” flag, you will need to perform  the following steps: We will try to extract the same archivo .gz that we created earlier by running the command below:

 

 Here you can replace FileName with the name of your archivo.gz, which in our case was gzFile.txt. When you visit your home directory after you run this command, you will notice that your actual file has been extracted. However, your archivo.gz has also been preserved due to the execution of the above mentioned command.

Method 3:

Using the “gunzip” command: This method is an exact alternative to our #1 method, which means that once you extract the actual file, the archivo.gz will no longer be preserved. To use the “gunzip” command to extract and open a archivo.gz, you will need to perform the following steps: We will try to extract the same archivo.gz that we created earlier by running the command below:


 Files with the tar.gz or.tgz extension represent tar files compressed with gzip.

To unzip these files from the Linux command line, follow these steps: Use SSH to connect to the server.

For tar.gz files, type:


 For .tgz files, enter:


 If you are using 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:

Summary:
Step1:

Open a terminal window by clicking “Applications”, “Accessories” or “System Tools” and “Terminal”.
Step2:

access to the directory containing the GZ file by typing “cd” in the “Terminal” window, pressing “Space”, typing the directory name and pressing “Enter”. For example, go to the “Downloads” directory by typing “Downloads CD” in the “Terminal” window and pressing “Enter”.
Step3:

access to the directory containing the GZ file by typing “cd” in the “Terminal” window, pressing “Space”, typing the directory name and pressing “Enter”. For example, go to the “Downloads” directory by typing “Downloads CD” in the “Terminal” window and pressing “Enter”.
Step4:

Unzip a archivo.tar.gz by typing “tar -zxvf” in the “Terminal” window, pressing “Space”, typing the name of archivo.tar.gz, and pressing “Enter”. For example, unzip a file named "example.tar.gz" by typing “tar -zxvf example.tar.gz" in the “Terminal” window and pressing “Enter”.
Step5:

Type”. /configure “and press “Enter” on the keyboard, this allows Linux to compile a program. Type “make” to start compiling the program.
Step6:

Use the command “su” to return to the root directory, then type “make install” and press “Enter” to install the new software in the appropriate location.

Conclusion:


The four methods described in this article provide you with excellent solutions for extracting and opening archivos.gz as well as the.tgz files on Linux. You can choose to follow any of these methods according to your taste.

 

 

 

 

 

 

 

Post a Comment

0 Comments