14.04 - a command to list all packagas installed on the system and their installed files, how? - Ask Ubuntu
i using ubuntu 14.04 lts, trusty. want execute command list installed packages of system , each packages name , should list files package has installed on system. how can that?
you can run following command print information in terminal:
for in $(echo $(apt list 2>&1| grep installed | sed 's|/.*$||g')); echo $i; dpkg -l $i | grep -p '^.'$i'|$'; done | tee aptinstalled | grep -p '^[a-z0-9].*$|$'
the command creates file information named aptinstalled
.
alternatively, if list of files of installed package, can run command dpkg -l
followed package name.
for example, list files installed package gnome-terminal
, run following command:
dpkg -l gnome-terminal
if want list installed packages, can run following command:
apt list 2>&1| grep installed | sed 's|/| |g;s|\[.*$||g' | grep_color='0;32' grep --color=auto -p '^.* '
if want list installed packages without information, can run instead:
apt list 2>&1| grep installed | sed 's|/.*$||g'
if list installed package names in linear form instead of column, can run following command:
echo $(apt list 2>&1| grep installed | sed 's|/.*$||g')
finally, if list installed packages , brief description of each package, run following command:
dpkg -l | grep --color=always ii
the last command highlight "ii" in red printed directly before each package name make easier distinguish between package names , descriptions.
or, run following command instead:
dpkg -l
additionally suggested @steeldriver in comment, can use -f
flag dpkg-query
command print name. here's example:
dpkg-query -w -f='${package}\n' | while read -r p; echo "$p" & dpkg-query -l "$p"; done
and here package name highlighted in green:
dpkg-query -w -f='${package}\n' | while read -r p; echo "$p" & dpkg-query -l "$p"; done | grep_color='0;32' grep -p --color=auto '^[a-z0-9].*$|$'
and here in form of script create new directory ~/packagefiles
. executing script create text file each package installed in new directory. each text file contains list of files each package. print in terminal normal, each package name highlighted in green:
#!/bin/bash mkdir -p /home/$user/packagefiles 2>&1 dpkg-query -w -f='${package}\n' | while read -r p; echo " $p" & dpkg-query -l "$p" | tee /home/$user/packagefiles/"$p"; done | grep_color='0;32' grep -p --color=auto '^[a-z0-9].*$|$'
this convenient because each package listed in directory , ls ~/packagefiles
list packages in nice columns.
don't forget make script executable.
Comments
Post a Comment