Bobcares

How to list installed software on CentOS 7 & Ubuntu 18

by | Jan 25, 2021

Wondering How to list installed software on CentOS 7 & Ubuntu 18? We can help you.

In this article, we will see the commands to list all software, list the number of packages installed, and search for a specific package.

Also, we will add installed software on a text file, and later install the software from the text file.

Here at Bobcares, we use these commands often as a part of our Server Management Services.

 

How to list installed software on CentOS 7 & Ubuntu 18

We will use a file to store a list of all currently installed software named “allsoftwares.txt”

Incase of reinstalling 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 go through the commands used by our Support Techs to list installed software on CentOS7 and Ubuntu18.

Commands used for CentOS7

list installed software

 

Yum and rpm are commonly used on CentOS 7 servers.

1. Using RPM

To List all software:

[root@host ~]# rpm -qaCopy Code

For listing the number of packages installed:

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

To search for a specific package:

[root@host ~]# rpm -q tmuxCopy Code

Adding installed software to a text file:

[root@host ~]# rpm -qa | tr '\n' ' ' > allsoftwares.txtCopy Code

 

2. Using YUM

To list all software:

[root@host ~]# yum list installedCopy Code

For listing the number of packages installed:

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

To search for a specific package:

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

Adding installed software to a text file:

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

Install software from the text file:

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

 

Commands used for Ubuntu18

 

list installed software

Apt and dpkg are commonly used on Ubuntu servers

1. Using APT

To list all software:

[root@host ~]# apt list --installedCopy Code

For listing the number of packages installed:

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

To search for a specific package:

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

Adding installed software to a text file:

[root@host ~]# apt list --installed > allsoftwares.txtCopy Code

Or

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

Installing software from the text file:

[root@host ~]# xargs -a allsoftwares.txt apt installCopy Code

 

2. Using DPKG

To list all software:

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

For listing the number of packages installed:

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

To search for a specific package:

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

Adding installed software to a text file:

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

or

[root@host ~]# dpkg --get-selections > allsoftwares.txtCopy Code

Installing software from the text file:

[root@host ~]# apt-get install < allsoftwares.txtCopy Code

[Need assistance? We are happy to help you!]

 

Conclusion

To conclude we saw the various commands our Support Engineers use 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).

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

0 Comments

Submit a Comment

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

Speed issues driving customers away?
We’ve got your back!