Sometimes we have a project folder that has different kinds of files in it, and we want to deliver it to anybody, then it is good practice to zip it so that all the files can be delivered safely. There are different ways of zipping a folder. In Ubuntu 22.04, we use a tar utility to zip the folders. 

In this article, we will explain how you can zip the folders using tar.

How do I tar and untar a folder in Ubuntu 22.04?

You can tar a folder using the terminal as well as you can use GUI. We’ll see both methods in this article.

Let’s explain how you can tar and untar a folder in Ubuntu 22.04. 

Method 1: Using the GUI

In this method, we will see that we can compress a folder using GUI. Select the folder you want to compress:

Click right, from the mouse button to open the dropdown menu, and select the “compress” option from the menu:

Then click on the zip drop-down icon, and select the tar. xz option from the drop-down menu, and click on the Create button, in the upper right corner: 

You can see, that the tar zip file has been added:

Now you can untar the folder, by selecting the tar file, clicking the right button from the mouse, to open the drop-down, and selecting the Extract here option from the drop-down menu:

You can see that the file has been untar successfully:

This is how you can tar and untar the files using the GUI method.

Now we’ll use the terminal for this purpose.

Method 2: Using the Terminal to tar and untar folder

In the terminal, we use the commands, to tar and untar the folder. For zipping a file use the following command:

$ tar cvf <tar filename.tar> <target folder name>

In the command, firstly specify the tar filename that would be a zipped file, we’ll provide the name of the folder that you want to tar, the sample command is shown in the diagram below:

You can verify the successful execution of the command, by seeing the folder in the directory you have created the tar file:

Now if you want to untar the folder you can use the following command:

$ tar xvf <your tar filename>

The command will require your specified tar file name to untar the folder, the sample input of the command is shown in the diagram below:

You can see that the output of the following command will untar the folder, navigate the directory in which you have untar the folder:

This is how you can tar and untar folders using the terminal and GUI. 


To tar and untar the folders in Ubuntu 22.04, you can use the GUI as well as the terminal with different commands, like tar xcf and tar xvf. The use of tar is very helpful when the folder has different files and you want to transfer. In this article we have explained how you can tar and untar folders in Ubuntu 22.04.