List Installed Packages in Ubuntu

Hello friends, long time I didn't write something in this old blog. On this occasion I think it would be interesting to discuss about the command to display the installed packages (Ubuntu) in our computers. And for the bonus, I also wanna write some commands to show the installed packages in CentOS.

Open your Ubuntu's Terminal, and then run the command below (only one command line NOT two):

sudo dpkg-query -Wf '${Installed-Size} - ${Package}n \n' | sort -n
Alternatively, you can use:
sudo aptitude search '?installed'
And this is for CentOS to do similar job:
yum list installed
For any Linux machine with rpm installed, you can use the command below to make a list of rpms installed:
rpm -q -a
To query a single package (and get version info) use:
rpm -q package name
The package name is the name WITHOUT the version number, so just write the letters not the number. For exmple to query the presence of mysql-server-3.23.58-16.FC3.1 use
rpm -q mysql-server
To get a list of the files provided by a package use:
rpm -q -l package name
to find out a particular file provided by a package (very useful to find out what machine A has that provides a file Machine B needs but doesn't have)
rpm -q --whatprovides full path to file in question
To find where files are installed use:
rpm -ql package_name
Again, use the package name - the letters not the numbers. This will list the path to the files installed by the package.

The actual rpm database is stored in /var/lib/rpm, but you should never have to work with these files.



  1. There is certainly a lot to find out about this issue. I love all of the points you've

    My web page: sex