Ubuntu

How to List all Installed Packages in Ubuntu Using apt?

How to List all Installed Packages in Ubuntu Using apt copy

In Ubuntu, a bunch of Packages are Installed and it might be hectic for a User when searching for a specific Package or a specific version of a Package. Thus, to keep track of the packages installed on your Ubuntu System and also to troubleshoot any dependency or error, the User must know the Packages Installed on their Ubuntu System. Also, if any manual upgrade of a package is required, the current version of the installed package must be known. For this purpose, Ubuntu offers the “apt” command which lists all the Installed and even the Available Packages on your System.

This article demonstrates the use of the “apt” command in listing installed packages on Ubuntu.

How to List all Installed Packages in Ubuntu Using apt?

The “apt” or “Advance Package Tool” is a useful command in the Terminal that is used for updating packages, removing a specific package, and also for installing a specific package. The “apt” command can be used in multiple approaches along with multiple options.

  • List Installed and the Available Packages with the “apt” Command.
  • List Specific Packages using the “apt” Command.
  • List Packages Matching a Pattern using the “apt” Command.
  • List the Number of Installed Packages using the “apt” Command.
  • List Upgradable Packages using the “apt” Command.
  • List All Versions of Packages using the “apt” Command.

Open Terminal

As you will use the “apt” command in the Terminal of your Ubuntu System, open the Terminal Directly with the “ctrl+alt+t” command:

List all Installed and Available Packages

The “apt” command can be used to list all the Installed as well as the Available Packages in the Repository using the “apt” command. To list the Installed and Available Packages, the “apt” command along with the “list” command is used:

apt list

This will list all the available and Installed packages in the Terminal:

The “list” command outputs all the available packages. Although the listed packages in the Terminal are in large amounts, you can filter the list to only list the first 10 lines while retrieving the installed and available packages. To filter only the first 10 lines, use the “head” command:

apt list | head

The Terminal will only display the first 10 packages that are either available or installed on your Ubuntu System:

To list solely the installed packages in the Terminal, you can use the “–installed” option:

apt list --installed

The Terminal will filter and list only the packages that are currently installed on your Ubuntu System:

As the list is too long for you to read, you can also make it easier to read by using the “less” command with the “apt list” Command:

apt list --installed | less

A new window will appear in the Terminal that will list the Packages:

In this new window in the Terminal, you can now manually see the packages by pressing Enter. Pressing Enter will list a new package and so on, which makes it easier for the user to read the packages:

Once you are done reading the list, you can exit the packages list window by pressing “q”.

List Specific Package using “apt” Command

Apart from listing all the packages which, in some cases, is hectic for you to read, you can list a specific package as well. With the “apt list” command, you can specify the package you want to be listed in the Terminal by writing only the package name:

apt list <packageName>

In our case, we searched for the “python3” package using the “apt list” Command:

apt list python3

The Terminal will list both the available and the installed package of “python3”:

To only list the Installed package, the “–installed” command can be used. Using our previous case, to list only the Installed Packages of “python3”, the command will be:

apt list python3 --installed

The Terminal will only list the Installed “Python3” Packages:

The [installed, automatic] message in front of the listed package in the Terminal indicates the package was installed automatically as a dependency for another software package.

You can also list the Information about a specific package in the Terminal with the “apt show” command having the syntax:

apt show <packageName>

In our case, to list the information about the “python3” package installed on our Ubuntu System, the “apt show” command will be:

apt show python3

The information about the “Python3” package will be displayed in the Terminal:

List Packages matching a Pattern Using the “apt” Command

With the “apt” command, you can also list only specific packages that match a specified pattern. The “pattern” command is used along with the “apt list” command to list only the specific packages that match the given pattern. The pattern command can either be used to list the Packages that start with a specified pattern, or that end with the specified pattern.

To List Packages starting with a specific pattern, the “pattern” command along with the “apt list” command will be:

apt list pattern '<startingPattern<strong>>*'</strong>

In our case, to list only the packages that start with the word “fir”, the “apt list” command will be:

apt list pattern 'fir*'

The Terminal will display all the Packages that start with the word “fir”:

Similarly, to list all the packages starting with the word “clon”, the “apt list” command will be:

apt list pattern 'clon*'

As you can see in the Terminal, only the packages that start with “clon” are listed:

Now, to List Packages ending with a specific pattern, the “apt list” command along with the “pattern” command will be:

apt list pattern '*<endingPattern>'

In our case, to list all the packages that end with the word “compact”, the “apt list” Command will be:

apt list pattern '*compact'

As you can see in the Terminal, only the Packages that end with “compact” are displayed:

Similarly, to list only the packages ending with the word “dep”, the “apt list” command will be:

apt list pattern '*dep'

The Terminal will only display the Packages ending with “dep”:

List the Number of Installed Packages using the “apt” Command

Using the “apt” command along with the “list” command, you can list the number of installed packages on Ubuntu. To list the Number of Installed packages on your Ubuntu System, the “wc -l” option is used along with the “apt list” command:

apt list --installed | wc -l

In our case, the Terminal displays 1904 packages that are currently installed on our Ubuntu System:

You can also list the number of installed packages of a specific Application on your Ubuntu System. To list the number of Installed Packages, use the name of the Package along with the command:

apt list <packageName> --installed | wc -l

In our case, to list the Number of Installed Packages of the Firefox Application on our Ubuntu System, the “apt list” command will be:

apt list firefox --installed | wc -l

The Terminal displays 2 installed packages of Firefox on our Ubuntu System:

List the Upgradeable Packages using the “apt” Command

You can also list the Upgradeable Packages on your Ubuntu System using the “apt” command. To list all the Packages on your Ubuntu System that require an Upgrade, sync your Ubuntu repository first with the “apt update” Command:

sudo apt update

The “apt update” command will look for the packages that require any upgrade:

Now, to list all the Packages requiring an Upgrade, use the “apt list” command along with the “–upgradeable” option:

apt list --upgradeable

Only the Packages that require an Upgrade will be listed in the Terminal:

List All Versions of Packages using the “apt” Command

With the “apt” Command, you can also verify a specific version of a package installed and available on your Ubuntu System. To list all the Versions of Installed and Available Packages on your Ubuntu System, use the “apt list” command along with the “–all-versions” which filters and lists all the versions of the Packages:

apt list --all-versions

All the Versions of the Installed and Available Packages will be displayed in the Terminal:

You can also filter your list with a specific Package Name with the Syntax:

apt list --all-versions <packageName>

In our case, to list all the Installed and Available Versions of Packages of the Firefox Application, the “apt list” command will be:

apt list --all-versions firefox

The Terminal will display all the Versions of the Firefox Application:

Similarly, to list all the Package Versions of “sudo”, the “apt list” command will be:

apt list --all-versions sudo

The Terminal will display all the Packages Version as follows:

Conclusion

Keeping track of the packages Installed on your Ubuntu System is crucial for troubleshooting any dependency or error in the Packages or your overall System. With the “apt” command, you can easily list all the Installed as well as the Available Packages, you can list specific packages installed on your Ubuntu System, and you can also list the upgradeable and the number of installed packages on your Ubuntu System, and you can modify your search with the “pattern” command. This article explained each methodology in detail with examples.

Similar Posts