I am using Ubuntu 14.04 LTS, Trusty. I want to execute a command to list all the installed packages of the system and for each packages name , it should list all the files that package has installed on the system.
how I can do that?
Ubuntu – A command to list all packagas installed on the system and their installed files, how
14.04
Best Answer
You can run the following command to print this information in the terminal:
The command also creates a file with this information named
APTINSTALLED
.Alternatively, if you would like to list all of the files of an installed package, you can run the command
dpkg -L
followed by the package name.For example, to list all the files installed with the package
gnome-terminal
, run the following command:If you just want to list all installed packages, you can run the following command:
If you only want to list the installed packages without the extra information, you can run this instead:
If you would like to list the installed package names in a linear form instead of a column, you can run the following command:
Finally, if you would like to list all installed packages and a brief description of each package, run the following command:
The last command will highlight "ii" in red which is printed directly before each package name to make it easier to distinguish between the package names and the descriptions.
Or, you could just run the following command instead:
Additionally as suggested by @steeldriver in a comment, you can use the
-f
flag with thedpkg-query
command to print the name. Here's an example:and here it is with the package name highlighted in green:
and here it is in the form of a script that will create a new directory
~/packagefiles
. Executing this script will create a text file for each package installed in the new directory. Each text file contains the list of files for each package. This will also print in the terminal as normal, each package name highlighted in green:This is convenient because each package is listed in the directory and so
ls ~/packagefiles
will list all packages in nice columns.Don't forget to make the script executable.