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 with apt

If you want to remove unwanted software from your system, it can be helpful to have a list of all installed packages right in front of you. On Ubuntu, APT makes it easier for users to get a list of the packages that are currently installed on their system.

This guide will show you how to list installed packages on Ubuntu using APT, the standard package manager for Debian-based distributions.

Get a list of the packages installed on Ubuntu

To get a list of the packages that are currently installed, upgradeable, or available on Ubuntu, you can use the perform Method of the APT command. To only print packages that are installed on your system, enter the –Set up mark with the command.

sudo apt list –installed

Output:

Using the apt list function Ubuntu

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

To get clean output suitable for use in scripting and output delivery, you can use string manipulation tools such as sed or awk. For example, to print the package names only:

sudo apt list –installed | awk & # 39; {split ($ 0, a, "/"); print a (1)} & # 39;

Output:

clean output with awk ubuntu

Related: These sed examples will make you a Linux power user

You can also count the total number of packages. All you have to do is pass the output from the above command along with it Toilet. Word count, abbreviated to wc, is a Linux utility that counts the number of characters, words, or lines in a text file.

sudo apt list –installed | toilet -l

Output:

Counting the number of installed packages ubuntu

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

Using dpkg-query

Users running older versions of Ubuntu can use the dpkg query Command to get a list of installed packages.

sudo dpkg-query -l

By default, dpkg presents the output in a clean table format.

List installed packages with dpkg

Run the following command to remove additional information and only print the names of the packages:

sudo dpkg-query -f & # 39; $ {binary: Package} ⁠n & # 39; -W

Output:

clean output with dpkg-query

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

Effortless package management with APT

In addition to perform Method, APT has several other functions that provide information about Linux packages. It also takes away the headache of removing unnecessary dependencies by keeping a record 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-based systems use pacman and DNF, respectively, as the standard package manager.

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 with APT and dpkg. But which one is more suitable for your needs?

Continue reading

About the author

Deepesh Sharma
(79 articles published)

Deepesh is Junior Editor for Linux at MUO. He writes informational guides on Linux with the aim of providing a blissful experience for all newbies. I'm not sure about movies, but if you want to talk about technology, he's your type. In his spare time he can be found reading books, listening to different genres of music, or playing guitar.

More
From Deepesh Sharma

Subscribe to our newsletter

Subscribe to our newsletter for tech tips, reviews, free e-books, and exclusive offers!

Click here to subscribe