While it is easy to install and manage many applications from the Ubuntu Software Center, it is often convenient to be able to manage installation and other operations from the command prompt. In Ubuntu, management and installation of applications from the command line is handled by APT (Advanced Package Tool).
Mastering this will allow you to have better control over the process of installing applications on your machines. As you become more familiar with Ubuntu APT, you’ll even be able to manage your installed apps faster 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 need to use sudo
in front of the commands below.
Installation of the application
There are several different commands associated with installing applications with APT.
Install a new package
To install a new package, use the command below:
Install multiple packages with a single line of code
Instead of installing the packages one by one, they can also be installed using the command below:
sudo apt install package1 package2 package3

Package deletion
There are a few options for removing packages in APT. Deleting packages is more nuanced than simply deleting files from a folder, and the commands available to support deleting packages support it.
Remove a package while leaving the configuration files intact
If you want to remove a package from your computer while leaving the configuration files intact, you can use the command below. This method is useful for packages that you can reinstall later.

Remove package with configuration files
If you want to remove all configuration files associated with a package, use the command below. This command is useful for packages that you do not plan to reinstall and would like to see completely removed from your system.

Remove one package and install another in one go
It is actually quite common to remove one package because another is more appropriate. Whatever the reason, 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 remove package1 and install package2.

Remove unnecessary packages
To remove unnecessary packages, you can use the command below:
You can combine this with removing packages, so that all unnecessary packages are removed when you uninstall a package.
sudo apt autoremove package
Maintain your Ubuntu system with APT
Just like with a physical object, you will 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 optimal condition. The command below resynchronizes the package index files with their sources.

Upgrade packs
The command below upgrades all packages installed on your system to the latest versions.

This command also upgrades system packages, but it can also remove installed packages to avoid conflicts.
Finding Packages and Package Information
You might be looking for a package, but you might not be sure of the name. You can also just search for information about a package. Find out how to achieve this below.
Localization of packages with keywords
To search for a package containing a particular keyword, you can use the command:

View 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

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

The following command provides a list of all available packages, including information about the versions and architecture of the package:
sudo apt list | grep package_name
If you want to see all the packages you have installed on your system, use:
sudo apt list --installed
To display a list of upgradeable packages, use the following command:
sudo apt list --upgradeable
Now that you know how to use Ubuntu Apt, there are times when a package is broken and you need to fix it. Learn how to fix broken packages in Ubuntu. Or, if you prefer Software Center and it isn’t working, check out our guide for help with fixing Software Center not working in Ubuntu.
Related:
Is this article useful?
!function(f,b,e,v,n,t,s)
{if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};
if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version=’2.0′;
n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];
s.parentNode.insertBefore(t,s)}(window, document,’script’,
‘https://connect.facebook.net/en_US/fbevents.js’);
fbq(‘init’, ‘400239050508508’);
fbq(‘track’, ‘PageView’);