How To Install tar on Ubuntu 22.04

In this tutorial we learn how to install tar on Ubuntu 22.04. tar is GNU version of the tar archiving utility

Introduction

In this tutorial we learn how to install tar on Ubuntu 22.04.

What is tar

tar is:

Tar is a program for packaging a set of files as a single archive in tar format. The function it performs is conceptually similar to cpio, and to things like PKZIP in the DOS world. It is heavily used by the Debian package management system, and is useful for performing system backups and exchanging sets of files with others.

There are three methods to install tar on Ubuntu 22.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install tar Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install tar using apt-get by running the following command:

sudo apt-get -y install tar

Install tar Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install tar using apt by running the following command:

sudo apt -y install tar

Install tar Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install tar using aptitude by running the following command:

sudo aptitude -y install tar

How To Uninstall tar on Ubuntu 22.04

To uninstall only the tar package we can use the following command:

sudo apt-get remove tar

Uninstall tar And Its Dependencies

To uninstall tar and its dependencies that are no longer needed by Ubuntu 22.04, we can use the command below:

sudo apt-get -y autoremove tar

Remove tar Configurations and Data

To remove tar configuration and data from Ubuntu 22.04 we can use the following command:

sudo apt-get -y purge tar

Remove tar configuration, data, and all of its dependencies

We can use the following command to remove tar configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge tar

References

Summary

In this tutorial we learn how to install tar package on Ubuntu 22.04 using different package management tools: apt, apt-get and aptitude.