get package details in linux

How to Get Package Details in Ubuntu

Ubuntu allows you to install, upgrade & delete various packages on your system. Sometimes you may need to get details of a particular package to be able to better understand its features & limitations. Here is how to get package details in Ubuntu.


How to Get Package Details in Ubuntu

Here are the steps to get package details in Ubuntu. You may use these commands in other Debian Linux Systems also.


1. List all packages

Open terminal and run the following command to list all packages installed on your system.

$ sudo apt list
OR
$ sudo apt list --installed

You will see the following kind of output depending on your packages installed. It will list all packages installed on your system alphabetically. In each line, it will display its version and its update type – manual/automatic.

accountsservice/bionic,now 0.6.45-1ubuntu1 amd64 [installed,automatic]
acl/bionic,now 2.2.52-3build1 amd64 [installed,automatic]
acpid/bionic,now 1:2.0.28-1ubuntu1 amd64 [installed,automatic]
...

The above output can be very long if you have too many packages on your system. So you may want to use it with more command.

$ sudo apt list | more

If you want to view only specific packages then pipe the above command’s output to grep command. Here is an example to list only nginx package

$ sudo apt list | grep nginx
nginx/bionic-updates,bionic-security,now 1.14.0-0ubuntu1.7 all [installed]
nginx-common/bionic-updates,bionic-security,now 1.14.0-0ubuntu1.7 all [installed,automatic]
nginx-extras/bionic-updates,bionic-security,now 1.14.0-0ubuntu1.7 amd64 [installed]

You can also use the apt list command with -a option for the above output.

$ sudo apt list -a nginx

Sometimes you may get the following warning, when you use apt command.

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

You may also use dpkg command to list all packages instead.

$ dpkg --list | grep nginx
$ dpkg --list | more


2. List Package Details

If you want to see specific details of a package, use apt-cache command.

$ sudo apt-cache show PACKAGE

Here is an example to get package details of nginx.

$ sudo apt-cache show NGINX
Package: nginx
Architecture: all
Version: 1.14.0-0ubuntu1.7
Priority: optional
Section: web
Origin: Ubuntu
Maintainer: Ubuntu Developers ubuntu-devel-discuss@lists.ubuntu.com
Original-Maintainer: Debian Nginx Maintainers pkg-nginx-maintainers@lists.alioth.debian.org
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 43
...

You will also get the above output using dpkg command as shown below.

$ sudo dpkg -L PACKAGE

Here is an example to get package details of NGINX.

$ sudo dpkg -L nginx

In this article, we have learnt how to list all installed packages on your system as well as how to get details of specific packages, using apt list and dpkg commands. This is useful if you want to understand the version & build of a specific package on your system, and use this information to find out the features supported in it. It is also useful to find out package details to understand if it is compatible with other software on your system.

Also read:

How to Force Download in Apache Server
How to Copy to Clipboard in Javascript
How to Check Commands Executed by Users in Linux
How to View User Login History in Linux
How to Send Email in Python

Leave a Reply

Your email address will not be published. Required fields are marked *