How to List Installed Packages on Ubuntu Linux

ubuntu
ubuntu logo
ubuntu

How to List Installed Packages on Ubuntu Linux

If your preferred Linux distribution is Ubuntu or other Debian-based Linux distributions.  It is important to occasionally check your installed packages. 

What Are Packages in Ubuntu?

In Debian-based Linux distributions such as Ubuntu,  packages are pre-compiled archives containing software applications, libraries, and associated files. The package management system simplifies the installation, removal, and updating of software on your system.

Ubuntu employs a package management system to handle the installation, upgrading, configuration, and removal of software. Let’s explore how this works:

  1. Packages in Ubuntu usually have a `.deb` extension at the end. They are composed of metadata, related files and instructions to execute given functions or run software in the Ubuntu system. 
  2. Packages are stored in groups called repositories normally found online. The repositories are defined in the `/etc/apt/sources.list` file and the `/etc/apt/sources.list.d` directory in the Ubuntu system
  3. APT (Advanced Packaging Tool): this is a tool found in Ubuntu which is used to install new software, update already installed packages and update the list of packages. It is also used to update the whole Ubuntu system. 
  4. Dependencies: These are additional packages required for an installed package to work properly. These dependencies are installed automatically by the package management tools in Ubuntu together with the original package. 
  5. Binary Format: Packages come in binary format which enable for a quick installation because they are pre-compiled and therefore no need for additional software. 
  6. Graphical Interface: Ubuntu contains a user friendly graphical interface which makes it easy to use the package management system for new users.

Reasons Why You Might Want to List the Packages Installed on Your Ubuntu System:

  • Inventory: Listing packages can help maintain an inventory of installed packages and can help you understand what software is present on your system and identify potential conflicts or dependencies.
  • Troubleshooting: Listing packages can help with certain system issues. It can provide valuable information about the software environment and potential culprits.
  • System Management: If you need to duplicate or migrate a system’s software setup, having a list of installed packages can be invaluable  to ensure you don’t miss anything. 
  • Cleanup: Listing packages can also help you identify and remove unnecessary or unwanted software, freeing up disk space and reducing potential security risks.

How to List Installed Packages on Ubuntu

Ubuntu system has  several ways to view the list of installed packages on your system. Whether you’re a beginner or an experienced user, knowing how to check installed packages can be helpful for troubleshooting, system maintenance, or documentation purposes.

1. Using the Command Line

The command line is a powerful tool for managing packages on Ubuntu. Open a terminal and try the following commands:

a. Using ‘dpkg’

‘dpkg’ is a low-level package manager that directly interacts with the package database. To list all installed packages, run:

dpkg --list

This command will display a detailed list of installed packages, including their names, versions, and descriptions.

Why you should use ‘dpkg’

  • Provides Detailed Information: dpkg –list provides an extensive list of installed packages, including their versions and descriptions.
  • Low-Level Control: Directly interacts with the package database.

Disadvantages:

  •   Verbose Output: The output can be overwhelming for beginners.
  •   Not User-Friendly: Requires familiarity with package names and syntax.

b. Using apt

apt (Advanced Package Tool) is a higher-level package manager that makes package management easier. To list installed packages using apt, run:

apt list  --installed

This command will show a concise list of installed packages.

Advantages:

  • Concise Output: apt list –installed offers a more compact list.
  • Higher-Level Tool: Simplifies package management
  • User-Friendly: Easier for beginners.

Disadvantages:

  • Limited Details: Doesn’t provide as much information as dpkg.
  • Dependency on APT Repositories: Requires an active internet connection to fetch package data

2. Graphical Package Managers

Ubuntu also provides graphical tools for managing packages:

a. Ubuntu Software Center

The Ubuntu Software Center (or just ‘Software’ in recent versions) is a user-friendly interface for installing and managing software. Open it from the application menu, navigate to the “Installed” section, and explore the list of installed packages.

Advantages:

  •  User-Friendly Interface: Ideal for beginners.
  •  Visual Exploration: Allows browsing through installed packages.
  •  Additional Features: Can install and remove software directly. 

Disadvantages:

  • Limited Customization: Less control over filtering or sorting.
  • Resource-Intensive: May consume more system resources. 

b. Synaptic Package Manager

For more advanced users, Synaptic Package Manager offers a comprehensive view of installed packages. Install it using:

sudo apt install synaptic

Launch Synaptic, click on “Status” > “Installed,” and browse through the packages.

Advantages:

  •  Comprehensive View: Shows detailed package information.
  •  Advanced Features: Allows package pinning, history tracking, and more.
  •  Customizable Filters: Can narrow down the list based on criteria.

Disadvantages:

  • Steep Learning Curve: Not recommended for novices.
  • Outdated Interface: May feel less modern compared to other tools.

3. Generating a List File

You can create a text file containing the list of installed packages. This is useful for documentation or system backups. Run the following command:

generating list file using dpkg

This will save the list to a file named installed_packages.txt.

Advantages:

  •  Documentation: Creating a text file (installed_packages.txt) serves as a record.
  •  Backup and Migration: Useful for system backups or transferring to a new machine.

Disadvantages:

  •  Static Snapshot: The list becomes outdated as you install or remove packages.
  •  No Real-Time Updates: Doesn’t reflect changes made after generating the file.

4. Customizing the Output

If you want to filter the list based on specific criteria (e.g., only display packages related to development), consider using grep or other text-processing tools. For example:

customizing output using dpkg

This command will show installed packages related to development.

Advantages:

  • Focused Results: Use tools like grep to filter specific packages (e.g., development-related).
  • Tailored Information: Allows you to extract relevant details. 

Disadvantages:

  • Requires Additional Commands: Involves combining commands for specific queries.
  • Learning Curve: Understanding regular expressions and text manipulation.

Recommended Practices for Managing Packages

When you are working with packages on Ubuntu it is important to consider the following practices:

  1. Use Official Repositories: It is advised to use installation packages from official Ubuntu repositories so as not to compromise on security and stability of your system and to make sure they are compatible. 
  2. Keep System Updated: It is important to keep the system’s package lists and packages up-to-date so as to bring security fixes and improvements on functionality. 
  3. Remove Unused Packages: In order to free up disk space on your system, one should regularly review and remove Unused Packages. This also helps in reducing security risks in your system. 
  4. Document Package Changes: To ensure that it is easy to troubleshoot and restore your system, keep a record of when you install new packages, remove old ones and update existing ones.
  5. Backup Before Major Changes: It is important to create a backup for your system when making changes. This makes it easier to rollback on the updates when something goes wrong. 

In conclusion, knowing how to list installed packages is an essential skill for maintaining a healthy system in Ubuntu Linux. Whether you prefer the command line or graphical tools, explore the options listed in the article and find the method that suits your needs. 

External Links:

How to List Installed Packages on Ubuntu 20.04 in 2024

How to List Installed Packages on Ubuntu and Debian-based Linux Distributions

Internal Links