How To Get List Of Packages Installed on Ubuntu
We explain how to see package listing, save files or remove packages installed on Linux Ubuntu
One of the frequent tasks of management is to know in detail what elements are installed in an operating system since this is useful for management such as:
- Licensing organization
- Acquisition of software
- Support tasks
- Audit and more
In the case of Linux, many times we can not know in detail how to understand and identify what packages we have in our distributions and therefore today we will give some guidelines for knowing these details with ease.
Step 1: Get List Instaled Packages with a Brief Description
If we want to display the list of packages that are installed in the system, just execute the following:
dpkg-query -l
We will see the following result:
If we only want to look at the list of packages without any description, we will run the following:
dpkg-query -f '${binary:Package}\n' -W
As a result, we will see this:
Step 2: Another Way To See Installed Packages
To know what packages we have installed in our distribution, we will use the following line:
dpkg --get-selections | grep -v deinstall
We can also use the next line:
apt list --installed
Step 3: Save Results To A Text File
If for some reason we want the results obtained to be redirected and stored in a text file for further analysis, we will execute the following:
dpkg --get-selections | grep -v deinstall > TheLinuxCode.txt
We can also use the following line:
dpkg -l | grep ^ii | awk ‘{ print $2}’ > mylist.txt
Step 4: Remove Unused Packages
It is normal that specific packages are no longer used in Linux and for this, they can be eliminated, this will free up disk space, for this task, we will execute the following:
sudo apt-get autoremove
We have seen how it is easy to see in detail what packages we have installed in our Linux distribution and thus have better control over them.