How to list the packages installed in Ubuntu with APT



Here’s how you can use Ubuntu’s default package manager to get a list of the packages currently installed on your system.

how to list installed packages using apt

When you want to remove unwanted software from your system, having a list of all the installed packages in front of you can help. On Ubuntu, APT makes it easier for users to get a list of the packages currently installed on their system.

In this guide, you will learn how to list the packages installed on Ubuntu using APT, the default package manager on Debian-based distributions.

Get a list of packages installed on Ubuntu

To view a list of currently installed, upgradeable, or available packages on Ubuntu, you can use the listing APT command method. To print only the packages installed on your system, specify the –installed flag with the command.

sudo apt list --installed

Go out:

using apt ubuntu list function

The output generated by the aforementioned command contains additional information, including the version number and the status of the package.

To get clean output suitable for use in scripting and output transfer, you can use string manipulation tools such as sed Where OK. For example, to print only the names of the packages:

sudo apt list --installed | awk '{split($0, a, "/"); print a[1]}'

Go out:

clean output with awk ubuntu

Related: These Sed Examples Will Make You A Powerful Linux User

You can also count the total number of packages. All you need to do is redirect the output of the aforementioned command with bathroom. Word Count, abbreviated wc, is a Linux utility that counts the number of characters, words, or lines in a text file.

sudo apt list --installed | wc -l

Go out:

count the number of ubuntu installed packages

As you can see from the above output, 2177 Linux packages are currently installed on the system.

Use dpkg-query

Users running older versions of Ubuntu can use the dpkg-request command for a list of installed packages.

sudo dpkg-query -l

Dpkg will present the output in a clean tabular format by default.

list installed packages using dpkg

To remove additional information and print only the names of the packages, run the following command:

sudo dpkg-query -f '${binary:Package}â n' -W

Go out:

clean up output using dpkg-query

Learn more: what is the difference between APT and dpkg in Ubuntu?

Package management made easy with APT

In addition to listing method, APT has several other functions that provide information associated with Linux packages. It also takes the headache out of removing unnecessary dependencies by keeping records of installed and uninstalled packages on your system.

Like APT, several other package managers are available for Linux, including DNF, pacman, and YUM. Most Debian-based distributions ship with APT, while Arch Linux and RHEL systems use pacman and DNF respectively as default package managers.

Cardboard boxes printed with the words apt and dpkg

What is the difference between APT and dpkg in Ubuntu?

Ubuntu and other Debian-based distributions manage packages using APT and dpkg. But which one is best suited to your needs?

Read more

About the Author



Leave A Reply