One of the important tasks of a system administrator is to analyze, install or remove packages on a system. Advanced package tool or apt is a package manager that is used in Debian, Ubuntu and related distributions for the installation, removal of packages.
In this article, we will use the same tool to list the softwares installed on a system. We will also check whether a specific package is installed or not.
List all the packages
To list all the packages in your system use the given command. It includes both installed and packages available for installation. These packages will get displayed from the apt package index. Now open your terminal and then execute the following command –
apt list
Or use the below command to make it easier to read the output on screen –
apt list | more
You can also use dpkg which is a low-level tool used in debian based systems for the installation and removal of packages. We can use it to list all the packages. Use the following command to list packages using dpkg –
dpkg --list
Or
dpkg --list | more
List Installed Packages only
Now to display packages that are currently installed in your system use --installed
option with the apt list
command. Use the command as it is given below –
apt list --installed
Or
apt list --installed | more
To display the list of installed packages by using dpkg, use the following command –
dpkg-query -l
This will display the package with its version, description and such other information.
or
dpkg-query -l | more
Find the information about a specific package
To know that a specific package is installed in your system or not. Use the following command in your terminal –
apt list -a package_name
For example-
apt list -a python
Since python is installed in my system so it is showing installed in the above image.
apt list -a nginx
If a package is not installed in your system then this command will display the package information as given in the above image.
Similarly, You can use the dpkg to display the information about a package
dpkg -l pattern
For example –
dpkg -l python
where,
ii – Indicates that the package is installed in the system.
Conclusion
Now by following the above steps, you can analyze the packages that are installed on your system. If you have a query or suggestion regarding this topic you can write to us in the comments below.