How to Use sudo Command to Install .tar.gz?

In Linux, the “tar.gz” is the archive file containing more than one file in a compressed format. A “tar.gz” file may contain simple files, and directories or comprise some installable files. If the “tar.gz” is equipped with some installable files then the users can install this file else the installation is not possible. The root/sudo permissions are compulsory for installing the “.tar.gz” files otherwise, the user permission will be denied.

This post will present the step-by-step procedure to use the sudo command for the installation of “.tar.gz” files in Linux. 

Install a tar.gz File Using sudo

The installation of the “tar.gz” files is quite simple, just go through the below-mentioned steps to install it.

Step 1: Extract the “.tar,gz” File

Extract the “tar,gz” file using the tar command as practiced in the following command: 

$ tar -zxvf nmap.tar.gz

Step 2: Jump Into the Extracted Directory

The next step is to jump into the extracted directory of the “tar.gz” file:

$ ls$ cd nmap-7.93

Step 3: Configure the Files

After that, configure all the files in the extracted directory by running the below command:

$ ./configure

Step 4: Compile the Files

Once you configure all the files, compile them using the “make” command in the terminal:

$ make

This process will take some time and files will be compiled.

Step 5: Install the Files

Now, the final step is to install the compiled files using the “sudo make” command. Run the below-given command:

$ sudo make install

Verify the Results

Let’s verify the installation of the nmap package by checking its version using the below command:

$ nmap --version

The nmap version 7.93 has been installed.


To install the “tar.gz” files, first, extract the file, and jump into the extracted folder. After that configure and compile the files and execute them with sudo. This write-up has illustrated the step-by-step procedure to install the “tar.gz” file using the sudo command.