Did you know that thousands of packages are installed on your Ubuntu system? You might be wondering where these packages came from.
A lot of your packages come pre-installed on a newly installed Linux system. You have probably also installed more packages over time to enhance the system’s functionalities.
Knowing how to list installed packages on your Ubuntu system can come in handy if you need to reinstall your system or install the same packages on another machine.
List Installed Packages Using APT
APT is a built-in package manager in Ubuntu that helps you install, update, and remove packages from your Ubuntu system. Additionally, the apt command can be used to display the list of installed packages on your system.
To use the apt command, open the terminal using the Ctrl+Alt+T keyboard shortcut and run the following command:
apt list --installedCode language: PHP (php)
This will display a list of all the packages that have been installed using apt. However, it will also list the packages installed as dependencies.
So, in addition to the applications you installed, you will have an extensive list of libraries and other packages that you did not install directly.

The output displays the package names, installed versions, and architecture. Furthermore, you can pipe the output to less to make it simpler to read because the package list is long.
apt list --installed | lessCode language: PHP (php)
You can use the grep command to filter the output to see if a specific package is installed. For example, to see if the firefox package is installed on our machine, we may use the following command:
apt list --installed | grep -i firefoxCode language: PHP (php)

Adding the -i option to the grep command ignores letter casing, allowing for a more comprehensive search.
To view information about a specific package, run apt show package_name.
apt show firefox

List Installed Packages Using dpkg Command
The dpkg command is used to install, build, and remove packages in Debian and its derivates. In addition, the dpkg command with added -l option lists all installed packages on a system.
dpkg -l

As you can see, the output displays the package names, installed versions, and architecture.
To check whether a specific package is installed, run dpkg -l and pipe the command output to the grep command, followed by the package name.
dpkg -l | grep -i firefox

Again, adding the -i option to the grep command ignores letter casing, allowing for a more comprehensive search.
List Installed Snap Packages
Snap is an alternative package manager system. However, the apt and dpkg-query commands do not list the packages that are installed as snaps. You can list these separately with the snap command.
Run the following command in the terminal to list all packages installed as Snaps on your system:
snap listCode language: PHP (php)

Count Installed Packages
Along with listing installed packages, you can also determine how many packages are installed on your system. To do so, use the following command:
dpkg -l | grep ii | wc -l

As you can see from the command output, there are 1921 packages currently installed on our Ubuntu system.
Conclusion
You should be able to list and filter installed packages on your Ubuntu system at this point. Feel free to leave a comment if you have any questions.
