Thursday, March 28, 2024

How to Use dpkg-query to View Packages on Ubuntu


 For older versions of Ubuntu without the apt package manager, you can use the dpkg-query command. Using dpkg-query is similar to apt, but this command cannot be used with remote repositories.

To view installed packages with their versions and brief descriptions, run the following command:

sudo dpkg -l

Use less with the dpkg command to limit the output as follows:

sudo dpkg -l | less

The dpkg query command generates a brief list of installed packages. To search for a specific package, add grep. Here's how the command looks:

sudo dpkg -l | grep packageName

Remember to replace packageName with the actual package. For example, enter the following command to display installed packages related to PHP:

sudo dpkg -l | grep PHP

Additionally, you can request information about a specific package using dpkg-query. Here's the command:

sudo dpkg-query -W packageName

Replace packageName with the actual package name.

0 comments:

Post a Comment