How to List Installed Packages on Ubuntu

How to List Installed Packages on Ubuntu
How to List Installed Packages on Ubuntu

List Installed Packages on Ubuntu

It will be always helpful to know which packages are installed on your machine. By checking installed packages you can install these packages on another system. In this tutorial, you will learn how to list installed packages on Ubuntu, how to list a specific package, how to install check installed package version, etc.

List Installed Packages

Use the following instructions to list installed packages on Ubuntu.

1. List Packages with APT Command

You can list installed packages using apt command. The apt is a package manager in Ubuntu System. To list installed packages on Ubuntu, run following command in the terminal:

sudo apt list --installed

The output should be:

how to list installed packages - apt command
how to list installed packages – apt command

To check a specific package installed or not on the system you can use apt command combined with grep command. To list specific package installed you can run the following command:

sudo apt list --installed | grep firefox

The output should be:

how to list installed packages - apt grep firefox
how to list installed packages – apt grep firefox

2. List Packages with DPKG Command

The dpkg command is also used to list installed packages on Ubuntu. You can also install packages by using dpkg command. To list all the installed packages you can run the following command:

dpkg --get-selections | grep -v deinstall

The output should look like:

how to list installed packages - dpkg command
how to list installed packages – dpkg command

You can also use the dpkg command to list specific package installed on your system. In the following command, it will be checked that firefox package installed on your system or not.

dpkg --get-selections | grep firefox

The output should be:

how to list installed packages - dpkg grep firefox
how to list installed packages – dpkg grep firefox

3. List Packages with dpkg-query Command

The dpkg-query command lists packages installed from dpkg command database. You can easily check the installed package from the dpkg command database using dpkg-query command. To list all the installed packages you can run the following command:

sudo dpkg-query -l

The output should look like:

how to list installed packages - dpkg-query command
how to list installed packages – dpkg-query command

As the installed packages list is huge. To pipe the output you can use less command:

sudo dpkg-query -l | less

You can also use the dpkg command to list specific package installed on your system. In the following command, it will be checked that firefox package installed on your system or not.

sudo dpkg-query -l | grep firefox

The output should be:

how to list installed packages - dpkg-query grep firefox
how to list installed packages – dpkg-query grep firefox

How to Export List of Installed Packages

You can export installed packages on Ubuntu using apt command. To export all the installed packages you can run following command:

sudo apt list --installed > installed_packages.txt

By using dpkg-query command you can export packages like given below:

sudo dpkg-query -f '${binary:Package}\n' -W > installed_packages.txt

You can install exported package with dpkg-query command on another system using following command:

sudo xargs -a installed_packages.txt apt install

How to count number of packages installed

You can following command to check the number of packages installed on your system:

dpkg --list | wc --lines

The output should be:

1630

Conclusion

Here you have successfully learned How to List Installed Packages on Ubuntu. If you have any queries regarding this then please don’t forget to comment below.

LEAVE A REPLY

Please enter your comment!
Please enter your name here