Mastering Ubuntu Apt And Become An Apt Guru

Ubuntu Apt Guru Featured

While it is easy to install and manage many applications from the Ubuntu Software Center, it is often convenient to be able to handle installation and other operations from the command prompt. In Ubuntu, app management and installation from the command line are handled by APT (Advanced Package Tool).

Getting a handle on this will allow you to have greater control over the process of installing applications on your machines. As you get more familiar with Ubuntu APT, you will even be able to manage your installed applications more quickly through the command line than with the included GUI software center.

Note: unless you are logged in with the root account on your system, you will have to use sudo in front of the commands below.

App Installation

There are several different commands associated with installing applications with APT.

Installing a New Package

To install a new package, use the command below:

sudo apt install package
Ubuntu Apt Guru Install 4

Install Multiple Packages with One Line of Code

Instead of installing packages one by one, they can also be installed by using the command below:

sudo apt install package1 package2 package3
Ubuntu Apt Guru Install Multiple

Package Removal

There are a few options for package removal in APT. Package removal is more nuanced than simply deleting the files from one folder, and the available commands for supporting package removal support this.

Remove a Package While Leaving Configuration Files Intact

If you want to remove a package from your computer but leave the configuration files intact, you can use the command below. This method is useful for packages you may reinstall at a later date.

sudo apt remove package
Ubuntu Apt Guru Remove 4

Remove Package Along With Configuration Files

If you want to remove all of the configuration files associated with a package, then use the command below. This command is useful for packages you don’t plan on reinstalling and that you would like to see completely cleared from your system.

sudo apt purge package
Ubuntu Apt Guru Purge 4

Remove One Package and Install Another in One Go

It’s actually quite common to remove one package because another one is more suitable. Whatever the reason may be, you can remove a package and install a package with one command. If you want to do this, enter the following:

sudo apt remove package1 package2+

In this case, you will be removing package1 and installing package2.

Ubuntu Apt Guru Remove Multiple

Remove Unneeded Packages

To remove unneeded packages, you can use the command below:

sudo apt autoremove

You can combine this with the removal of packages, so all unneeded packages are removed when you are uninstalling a package.

sudo apt autoremove package

Performing Maintenance on Your Ubuntu System with APT

Just like with a physical object, you’ll need to perform maintenance on your Ubuntu system from time to time.

Update System Packages

You should update your system packages regularly to keep your system running in peak condition. The command below resynchronizes the package index files with their sources.

sudo apt update
Ubuntu Apt Guru Update 4jpg

Upgrade Packages

The command below upgrades all packages installed on your system to the newest versions.

sudo apt upgrade
Ubuntu Apt Guru Upgrade

This command also upgrades system packages, but it may also remove installed packages in order to avoid conflicts.

sudo apt full-upgrade

Searching for Packages and Package Information

You may be searching for a package but may not be sure of the name. You may also just be looking for information about a package. Find out how to accomplish this below.

Locating Packages with Keywords

To find a package that contains a particular keyword, you can use the command:

sudo apt search keyword
Ubuntu Apt Guru Search 1 Keyword

Display Information About a Package

The command below will display information about a package, such as its version, size, dependencies, and any conflicts with it on your system.

sudo apt show package_name
Ubuntu Apt Guru Show Information

List Packages

If you want a list of all of the available packages, use the following command:

sudo apt list
Ubuntu Apt Guru List All Packages

The following command provides a list of all of the available packages, including information about the versions and architecture of the package:

sudo apt list | grep package_name

If you would like to see all the packages you have installed on your system, then use:

sudo apt list --installed

To see a list of packages that can be upgraded, use the following command:

sudo apt list --upgradeable

Now that you know how to use Ubuntu Apt, there are times where a package is broken and you need to fix it. Learn how to fix broken packages in Ubuntu. Or, if you prefer the Software Center and it is not working, check out our guide for help in fixing the Software Center not working issue in Ubuntu.

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox