How to Use apt Package Manager on Ubuntu

In this tutorial, we are learning about how to use apt package manager on Ubuntu. In Linux, special tools have been developed to manage applications. Application software for Linux is usually provided in a package. The default package manager for Ubuntu is apt-get.

The Linux operating system uses a software tool known as the package manager to ensure that software is properly installed and up-to-date. It also maintains an up-to-date list of available software, which is stored externally in a database called a repository.

Prerequisites

  • A Linux operating system
  • Access to a terminal/command line
  • The apt tool, preloaded in Ubuntu and Debian-based Linux

Since apt is a command-line utility, we will need to use the Ubuntu terminal. So open the terminal in your Ubuntu.

Update Ubuntu Package Repositories with apt

Refreshing your local software list before installing a new application is a good habit to develop. To refresh your local software list on Ubuntu, type the following in Terminal:

sudo apt update

Your system will check the repository for updated information. Show output when done.

Update Ubuntu using Apt

Installing a Package with apt

Now you can install any package using the apt command in the ubuntu operating system. In this tutorial, we are installing the terminator terminal. So following command for this:

sudo apt install terminator -y

Install Terminator First Time

tlt@ubuntu:~$ sudo apt install terminator 
[sudo] password for tlt: 
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  gir1.2-keybinder-3.0 libkeybinder-3.0-0 python3-configobj python3-psutil
Suggested packages:
  python-configobj-doc python-psutil-doc
The following NEW packages will be installed:
  gir1.2-keybinder-3.0 libkeybinder-3.0-0 python3-configobj python3-psutil
  terminator
0 upgraded, 5 newly installed, 0 to remove and 0 not upgraded.
Need to get 577 kB of archives.
After this operation, 3,508 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://us.archive.ubuntu.com/ubuntu jammy/universe amd64 libkeybinder-3.0-0 amd64 0.3.2-1.1 [8,916 B]
Get:2 http://us.archive.ubuntu.com/ubuntu jammy/universe amd64 gir1.2-keybinder-3.0 amd64 0.3.2-1.1 [3,168 B]
Get:3 http://us.archive.ubuntu.com/ubuntu jammy/main amd64 python3-configobj all 5.0.6-5 [34.8 kB]
Get:4 http://us.archive.ubuntu.com/ubuntu jammy/main amd64 python3-psutil amd64 5.9.0-1build1 [158 kB]
Get:5 http://us.archive.ubuntu.com/ubuntu jammy/universe amd64 terminator all 2.1.1-1 [372 kB]
Fetched 577 kB in 6s (103 kB/s)     
Selecting previously unselected package libkeybinder-3.0-0:amd64.
(Reading database ... 196128 files and directories currently installed.)
Preparing to unpack .../libkeybinder-3.0-0_0.3.2-1.1_amd64.deb ...
Unpacking libkeybinder-3.0-0:amd64 (0.3.2-1.1) ...
Selecting previously unselected package gir1.2-keybinder-3.0.
Preparing to unpack .../gir1.2-keybinder-3.0_0.3.2-1.1_amd64.deb ...
Unpacking gir1.2-keybinder-3.0 (0.3.2-1.1) ...
Selecting previously unselected package python3-configobj.
Preparing to unpack .../python3-configobj_5.0.6-5_all.deb ...
Unpacking python3-configobj (5.0.6-5) ...
Selecting previously unselected package python3-psutil.
Preparing to unpack .../python3-psutil_5.9.0-1build1_amd64.deb ...
Unpacking python3-psutil (5.9.0-1build1) ...
Selecting previously unselected package terminator.
Preparing to unpack .../terminator_2.1.1-1_all.deb ...
Unpacking terminator (2.1.1-1) ...
Setting up libkeybinder-3.0-0:amd64 (0.3.2-1.1) ...
Setting up gir1.2-keybinder-3.0 (0.3.2-1.1) ...
Setting up python3-psutil (5.9.0-1build1) ...
Setting up python3-configobj (5.0.6-5) ...
Setting up terminator (2.1.1-1) ...
update-alternatives: using /usr/bin/terminator to provide /usr/bin/x-terminal-em
ulator (x-terminal-emulator) in auto mode
Processing triggers for hicolor-icon-theme (0.17-2) ...
Processing triggers for gnome-menus (3.36.0-1ubuntu3) ...
Processing triggers for libc-bin (2.35-0ubuntu3.1) ...
Processing triggers for man-db (2.10.2-1) ...
Processing triggers for mailcap (3.70+nmu1ubuntu1) ...
Processing triggers for desktop-file-utils (0.26-1ubuntu3) ...
tlt@ubuntu:~$

Uninstall Package

The process for uninstalling or removing a package on Ubuntu is simple

sudo apt-get remove [package_name]

Replace [package_name] with the system name of your application. Make sure you double-check the name if you receive any errors.

Conclusion

Now you know how to manage Ubuntu packages with apt. The package manager is an incredibly handy feature for Linux users. They do most of the hard work for you, checking for updates and dependencies. With a basic understanding of apt-get, you have complete control over your Linux installation.

If you have any questions please leave them in the comments below.

Leave a Reply

Your email address will not be published. Required fields are marked *