How to List installed software Linux (CentOS 7 & Ubuntu 18) ?






Are you trying to list installed software on CentOS 7 & Ubuntu 18?

This guide will help you.

If you are planning to install, uninstall, or reinstall packages, the first step should always be to first list the installed packages. This lets you verify the installed version of the package and cross verify in case a specific package needs to be updated.
Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to perform Linux related tasks.
In this context, we shall look into the commands to list all software, list the number of packages installed, and search for a specific package.

How to list installed software on CentOS and Ubuntu Servers?

We will use a file to store a list of all currently installed software named "systemsoftware.txt"
If we need to reinstall the base Linux system, we can copy or upload this file into the system so that we will get all the software that existed before formatting the system.
Here, we shall go through the commands used by our Support Experts to list installed software on CentOS 7 and Ubuntu 18.

Commands to list installed software in CentOS 7 ?

Yum and rpm are commonly used on CentOS 7 servers.


i. Using RPM

To List all software:

[root@host ~]# rpm -qa

For listing the number of packages installed:

[root@host ~]# rpm -qa | wc -l

To search for a specific package:

[root@host ~]# rpm -q tmux

To add installed software to a text file:

[root@host ~]# rpm -qa | tr '\n' ' ' > systemsoftware.txt

ii. Using YUM

To list all software:

[root@host ~]# yum list installed

For listing the number of packages installed:

[root@host ~]# yum list installed | wc -l

To search for a specific package:

[root@host ~]# yum list installed | grep unzip

To add installed software to a text file:

[root@host ~]# yum list installed | awk '{print $1}' | tr '\n' ' ' > systemsoftware.txt

To Install software from the text file:

[root@host ~]# yum -y install $(cat systemsoftware.txt)

Commands to list installed software in Ubuntu 18 ?

Apt and dpkg are commonly used on Ubuntu servers

i. Using APT

To list all software:

[root@host ~]# apt list --installed

For listing the number of packages installed:

[root@host ~]# apt list --installed | wc -l

To search for a specific package:

[root@host ~]# apt list --installed | grep PHP

To add installed software to a text file:

[root@host ~]# apt list --installed > systemsoftware.txt

Or



[root@host ~]# apt list --installed | awk -F/ -v ORS=" " 'NR>1 {print $1}' > systemsoftware.txt

To install software from the text file:

[root@host ~]# xargs -a systemsoftware.txt apt install

ii. Using DPKG

To list all software:

[root@host ~]# dpkg -l | grep ^ii

For listing the number of packages installed:

[root@host ~]# dpkg -l | grep ^ii | wc -l

To search for a specific package:

[root@host ~]# dpkg -l | grep ^ii | grep -i PHP

To add installed software to a text file:

[root@host ~]# dpkg-query -f '${binary:Package}\n' -W > systemsoftware.txt

or


[root@host ~]# dpkg --get-selections > systemsoftware.txt

To install software from the text file:

[root@host ~]# apt-get install < systemsoftware.txt

[Need urgent assistance to install Software on Linux Servers? We are happy to help you! ]


Conclusion

This article will guide you on different methods to #list all #software, the number of #packages available on the server along with the method to copy them and use them when we reinstall our operating system(#OS).
Yum automatically refreshes the list of packages, whilst with apt-get you must execute a command 'apt-get update' to get the fresh packages.
To list of installed programs in #Linux:
1. Aptitude-based distributions (#Ubuntu, #Debian, etc): dpkg -l.
2. RPM-based distributions (#Fedora, #RHEL, etc): rpm -qa.
3. pkg*-based distributions (#OpenBSD, #FreeBSD, etc): pkg_info.
4. Portage-based distributions (#Gentoo, etc): equery list or eix -I.
5. pacman-based distributions (Arch Linux, etc): pacman -Q.



Related Post


Keep In Touch

We hope to hear from you.

Accept File Type: jpg,jpeg,png,txt,pdf,doc,docx