In Linux operating systems, especially in Ubuntu 20.04 system, we can use the “tar.gz” as an extension to compressed files. We can extract the “tar” files in some specific folder within the Linux operating system using the two different methods. We will discuss both of those methods in today’s article. So, let’s make a fresh start now.

Method 01: Using Graphical User Interface

Let’s start by logging in from the admin user of the Ubuntu 20.04 system. To extract the “tar” file in Linux, we must have some “tar” files in our system. If you don’t have one, try downloading it from the web using your system’s browser. Your downloaded “tar” file will probably be saved in your Linux system’s “Downloads” directory. You can see that we have downloaded a “tar” file in the Downloads folder. Don’t use the “Extract Here” option; it will decompress this file on your current location. Right-click on the “tar” file, and you have to select the option of “Extract to…” as presented in the dialogue on your screen. You can see several other options in the attached image, but make sure to select only the relevant ones.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/04/echo/image4-6.png" data-lazy- height="496" src="data:image/svg xml,” width=”584″>

The window is shown below, “Select Extract Destination,” which will appear on your screen. Now, it’s time to select the specific destination folder where you want to extract or decompress your “tar” file. You have the left sidebar on your newly appeared window to select that. This sidebar will show you many directories or folders of your Ubuntu 20.04 system. Select one from the top to bottom list by simply clicking on it. You can check that we have choosen the “Documents” folder here. Now that the folder is selected, you must tap on the green “Select” button from this opened window highlighted in the image below to extract the “tar” file. This will extract or decompress the whole “tar” file without wasting time. Also, if you want to create a new folder to extract the “tar” file within it, tap on the folder icon with a plus sign held at the bottom of the “Select” button. It will ask you for the folder’s name.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/04/echo/image6-6.png" data-lazy- height="195" src="data:image/svg xml,” width=”722″>

You can see from the image below that the “tar” file from the Downloads folder of the Ubuntu 20.04 Linux operating system has been extracted in the “Documents” folder within no seconds. The output clearly shows the progress.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/04/echo/image5-6.png" data-lazy- height="147" src="data:image/svg xml,” width=”481″>

Method 02: Using Terminal Command-line Shell

The other method to extract a “tar” file to some specific folder is using a Linux terminal shell. We need to open the Linux terminal shell from its applications using the “Ctrl Alt T” shortcut to use this method. You can also use the activity menu from the taskbar of the Ubuntu 20.04 system to open the shell terminal. Now, the terminal shell is launched and ready to use, we need to check the folder where the “tar” file is located. Currently, we are situated in the home folder of the Ubuntu 20.04 system in the terminal. To move towards the “Downloads” folder of Linux where our “tar” file is located, we have to make use of the “cd” query of Linux. You need to add the path to the “Downloads” folder within the “cd” command, as shown below. The control will move you within the “Downloads” folder. We have listed the contents of the downloads folder and got the single “tar” file as a return result. Execute the below instructions on the console of your operating system.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/04/echo/image8-4.png" data-lazy- height="55" src="data:image/svg xml,” width=”420″>

You want to extract your “tar” file within the same folder it is currently located in. For that, we need to use the “tar” command with the “-xf” flag for decompression along with the whole name of a “tar” file. The below-shown instruction shows that the “tar” command has been used to decompress the file within the same “Downloads” folder. Execute the below instruction on the console of your operating system.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/04/echo/image7-4.png" data-lazy- height="36" src="data:image/svg xml,” width=”683″>

On listing the contents of the “Downloads” folder, we have got the extracted decompressed file in blue along with its original “tar” file within the same folder. Execute the below instruction on the console of your operating system.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/04/echo/image2-8.png" data-lazy- height="39" src="data:image/svg xml,” width=”556″>

Now, if you want to extract or decompress your “tar” file to some other folder, you need to make use of the “-C” flag in the “tar” query along with the path to that specific folder. As you can have a look at the query presented in the image. It shows that we have extracted the “tar” file within the “Documents” folder of our Ubuntu 20.04 system. Execute the below instruction on the console of your operating system.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/04/echo/image1-10.png" data-lazy- height="36" src="data:image/svg xml,” width=”721″>

Use the “cd” command on the shell and the path to the specific folder to see the extracted file. List down the contents of a file after moving in the folder. You can see the extracted “tar” file in the specified “Documents” folder. Execute the below instructions on the console of your operating system.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/04/echo/image3-7.png" data-lazy- height="73" src="data:image/svg xml,” width=”444″>

Conclusion:

This is all about extracting the “tar” file of Linux to some specific folder. We have accomplished this goal using two methods, i.e., GUI and command shell. We have also seen how to extract the “tar” file within the same folder it is located in. Both methods are quite simple to learn and understand, and we hope that the Linux users will like them as well.

About the author

<img data-del="avatar" data-lazy-src="https://kirelos.com/wp-content/uploads/2022/04/echo/omar-150×150.png6254e95ade951.jpg" height="112" src="data:image/svg xml,” width=”112″>

Omar Farooq

Hello Readers, I am Omar and I have been writing technical articles from last decade. You can check out my writing pieces.