How to list packages installed on Ubuntu

How to list packages installed on Ubuntu

List packages installed on Ubuntu

It is always helpful to know which packages are installed on your machine. You can install these packages on another system by checking the installed packages. In this tutorial, you will learn how to list the packages installed on Ubuntu, how to list specific packages, and how to install the versions of installed packages.

List of installed packages

Use the following procedure to list the packages installed on Ubuntu.

1. List packages with APT command

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

sudo apt list --installed

The output looks like this:

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

To check if it is installed on the system, you can use apt Command combined with grep command. To list the specific packages installed, you can run the following command:

sudo apt list --installed | grep firefox

The output looks like this:

How to list installed packages -apt grep firefox How to list installed packages – list packages with apt grep firefox2 DPKG command

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

dpkg --get-selections | grep -v deinstall

The output looks like this:

How to list installed packages -dpkg command How to List Installed Packages – dpkg Command

You can also use dpkg A command that lists the specific packages installed on the system. The following command checks the following: firefox package installed on your system or not.

dpkg --get-selections | grep firefox

The output looks like this:

How to list installed packages-dpkg grep firefox How to list installed packages – dpkg grep firefox3. Listing packages with the dpkg-query command

of dpkg-query The command lists installed packages from the dpkg command database. Use the dpkg-query command to easily check installed packages from the dpkg command database. To list all installed packages, you can run the following command:

sudo dpkg-query -l

The output looks like this:

How to list installed packages-dpkg-query command How to List Installed Packages – dpkg-query Command

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

sudo dpkg-query -l | less

You can also use dpkg A command that lists the specific packages installed on the system. The following command checks the following: firefox package installed on your system or not.

sudo dpkg-query -l | grep firefox

The output looks like this:

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

How to export a list of installed packages

To export a package installed on Ubuntu, use: apt command. To export all installed packages, you can run the following command:

sudo apt list --installed > installed_packages.txt

using dpkg-query Commands that can export packages such as:

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

To install an exported package dpkg-query Execute the command on another system using the following command:

sudo xargs -a installed_packages.txt apt install

How to count the number of installed packages

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

dpkg --list | wc --lines

The output looks like this:

1630

Conclusion

Here you learned how to list the packages installed on Ubuntu. If you have any questions about this, don’t forget to comment below.

Sidebar