Linux dpkg list packages

How to list manually installed packages?

I’d like to get a list of packages installed manually by apt or aptitude and be able to find out whether a foobar package was installed manually or automatically. How can we do that from the command line?

Really good solution that excludes packages installed by default: Ubuntu list explicitly installed packages

«package was installed manually or automatically» How about manually or by dependency. I just did clean install of Debian for WSL, followed by apt update and custom install of only 5 package names: ack, zsh, vim, tree, git. Three of the high-vote solutions below make a list of 112 items.

20 Answers 20

You can use either of these two one-liners. Both yield the exact same output on my machine and are more precise than all solutions proposed up until now (July 6, 2014) in this question.

Using apt-mark :

Using aptitude :

Very few packages still fall through the cracks, although I suspect these are actually installed by the user, either right after the installation through the language localization setup or e.g. through the Totem codec installer. Also, the linux-header versions also seem to accumulate, even though I’ve only installed the non version-specific metapackage. Examples:

libreoffice-help-en-gb openoffice.org-hyphenation gstreamer0.10-fluendo-mp3 linux-headers-3.13.0-29 

How does it work:

  1. Get the list of manually installed packages. For aptitude, the additional sed strips out remaining whitespace at the end of the line.
  2. Get the list of packages installed right after a fresh install.
  3. Compare the files, only output the lines in file 1 that are not present in file 2.

Other possibilities don’t work as well:

  • Using the ubuntu-14.04-desktop-amd64.manifest file (here for Ubuntu 14.04) instead of /var/log/installer/initial-status.gz . More packages are shown as manually installed even though they are not.
  • Using apt-mark showauto instead of /var/log/installer/initial-status.gz . apt-mark for example doesn’t include the xserver-xorg package, while the other file does.

I used various other StackExchange posts as references, however none work as well as the above solution:

Both list more packages than the above solution.

Читайте также:  Linux узнать разрядность системы

EDIT: What to do if you’ve upgraded from a previous release:

If you’ve upgraded Ubuntu from one release to the next, you will probably need to adjust this process. In that case, I would check the manifest file of the newer release (see above) in addition to the initial-status.gz file from the current release. You can easily do that by just adding another comparison. Using just the manifest file will not work, as the manifest file unfortunately does not contain everything that the initial_status.gz file does (I checked).

This didn’t work for me because /var/log/installer/initial-status.gz is missing. Also I want to know if this is depending on apts marking of manual or not?

This answer is the best I found until now. However, it (still) misses transient package suggestions (and recommendations). For example, when I apt install git-review , only git-review gets listed. So far, so good. When I apt remove git-review , the package git stays but is not listed. That is because git is a ‘suggests’ in the package libdpkg-perl (see /var/lib/dpkg/status). The same happens for if a package was installed with apt install —no-install recommends and later another package installs that recommendation, then it stays but gets not listed. No idea how to catch those.

I originally installed an older version of Ubuntu and now I’m running 20.04, so I downloaded the manifest from releases.ubuntu.com/20.04/… and then I ran comm -23 <(apt-mark showmanual | sort -u) <(cat ~/Desktop/ubuntu-20.04.2.0-desktop-amd64.manifest | awk '‘ | sort -u) . Thanks!

In newer versions of the package apt, there is also the apt-mark command

@Umang You are right. I would say this wasn’t like this when I wrote this answer. There is no reason on my system to consider linux-image-3.11.0-*-generic etc as manual

@Umang maybe this will help you askubuntu.com/questions/432743/…, but the answer is not accepted. Fact is, that many packages of a fresh installation are already marked as manual. But there are still some strange things. To stay with my example: linux-image-3.13.0-24-generic is manual but the current linux-image-3.13.0-27-generic is automatic. It seems that an upgrade of a referencing package (in this case linux-image-generic , which changed the dependencies), the manual mark is automatically set

@DanielAlder some packages of a fresh installation should be marked as manual. If no packages marked as manual, the entire system could be deleted with apt-get autoremove . This is definitely not what you want.

Читайте также:  Install linux on mobile

@AntonK that is usually done with the ubuntu-minimal and ubuntu-standard packages, there’s no need for any of their dependencies to be marked as manual

To get a list of all packages (not installed, installed by user or installed by default, across all PPAs), apt employs the following method:

The possible options useful for this are:

—installed to display only the packages that are installed on the system (out of some 50,000+)

—manual-installed to list the packages that were explicitly installed by a command, either directly, or as dependencies.

Alternatively, you could do:

apt list —installed | grep -F \[installed\] to get a list of packages that resulted from user commands and their dependencies only, and to get additional information on them such as version and architecture supported (x86, x86_64, amd64, all, etc.)

This still appears to list packages included in the base installation, which were not explicitly installed by the user running apt install . .

For Ubuntu 16.04, check out the log file /var/log/apt/history.log .

zgrep 'Commandline: apt' /var/log/apt/history.log /var/log/apt/history.log.*.gz 

It’s not perfect, but it’s pretty good at making it clear exactly what I installed by hand. Put a -B 1 on the grep to see when it was installed.

Commandline: apt install postgresql-9.5-plv8 Commandline: aptdaemon role='role-install-file' sender=':1.85' Commandline: apt install task Commandline: apt autoremove Commandline: apt install atom Commandline: apt upgrade Commandline: apt-get install asciinema Commandline: apt install iperf3 Commandline: apt upgrade Commandline: apt-get install chromium-browser Commandline: apt install joe cpanminus build-essential postgresql libdbd-pg-perl libcrypt-openssl-bignum-perl libcrypt-openssl-rsa-perl libio-socket-ssl-perl libnet-ssleay-perl libssl-dev Commandline: aptdaemon role='role-commit-packages' sender=':1.2314' Commandline: apt install git Commandline: apt install sqlite Commandline: apt install whois Commandline: apt install libdbd-pg-perl Commandline: apt install perl-doc Commandline: apt upgrade 

Not sure if this picks up aptitude or not. It doesn’t seem to pick up installs from the Ubuntu Software desktop app.

Источник

How to list installed package and its details on ubuntu?

I am new to ubuntu and trying to find out the way to list all installed packages and its details like version, release, install time, category on Ubuntu. Found that following commands will help me get some of this information: 1) dpkg -l 2) dpkg-query -W -f=’$\t$\t$\n’ Unlike Redhat the install time and category information is missing in this. Can anyone know of a way to retrieve these details? Thanks in advance.

Читайте также:  Linux usr bin env

7 Answers 7

If you want to get the description of some specific packages say firefox :

sudo dpkg -l | grep firefox 
$ sudo dpkg -l | more Desired=Unknown/Install/Remove/Purge/Hold | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad) ||/ Name Version Description +++-===========================================-=======================================-============================================================== ================ ii accountsservice 0.6.15-2ubuntu9.4 query and manipulate user account information ii acl 2.2.51-5ubuntu1 Access control list utilities ii acpi-support 0.140 scripts for handling many ACPI events ii acpid 1:2.0.10-1ubuntu3 Advanced Configuration and Power Interface event daemon ii activity-log-manager-common 0.9.4-0ubuntu3.2 blacklist configuration for Zeitgeist (assets) ii activity-log-manager-control-center 0.9.4-0ubuntu3.2 blacklist configuration for Zeitgeist (control center integrat ion) ii adduser 3.113ubuntu2 add and remove users and groups ii adium-theme-ubuntu 0.3.2-0ubuntu1 Adium message style for Ubuntu ii aisleriot 1:3.2.3.2-0ubuntu1 Solitaire card games ii akonadi-backend-mysql 1.7.2-0ubuntu1 MySQL storage backend for Akonadi ii akonadi-server 1.7.2-0ubuntu1 Akonadi PIM storage service ii alacarte 0.13.2-2ubuntu4 easy GNOME menu editing tool ii alsa-base 1.0.25+dfsg-0ubuntu1 ALSA driver configuration files ii alsa-utils 1.0.25-1ubuntu5 Utilities for configuring and using ALSA ii anacron 2.3-14ubuntu1 cron-like program that doesn't go by time ii apg 2.2.3.dfsg.1-2 Automated Password Generator - Standalone version ii app-install-data 0.12.04.4 Ubuntu applications (data files) ii app-install-data-partner 12.12.04.1 Application Installer (data files for partner applications/rep ositories) ii apparmor 2.7.102-0ubuntu3.7 User-space parser utility for AppArmor ii appmenu-gtk 0.3.92-0ubuntu1.1 Export GTK menus over DBus ii appmenu-gtk3 0.3.92-0ubuntu1.1 Export GTK menus over DBus ii appmenu-qt 0.2.6-0ubuntu1 appmenu support for Qt ii apport 2.0.1-0ubuntu17.1 automatically generate crash reports for debugging ii apport-gtk 2.0.1-0ubuntu17.1 GTK+ frontend for the apport crash report system ii apport-symptoms 0.16.1 symptom scripts for apport ii apt 0.8.16~exp12ubuntu10.7 commandline package manager ii apt-transport-https 0.8.16~exp12ubuntu10.7 https download transport for APT ii apt-utils 0.8.16~exp12ubuntu10.7 package managment related utility programs --More-- 

To get the date and time of packages being installed

cat /var/log/dpkg.log | grep " install " 

To get for specific package:

$cat /var/log/dpkg.log | grep " install " | grep banshee 2013-12-12 12:51:48 install banshee 2.4.1-3ubuntu1~precise2 2013-12-12 12:51:51 install banshee-extensions-common 2.4.0-1ubuntu1 2013-12-12 12:51:51 install banshee-extension-radiostationfetcher 2.4.0- 1ubuntu1 2013-12-12 12:51:51 install banshee-extension-soundmenu 2.4.1-3ubuntu1~precise2 

To get the section

$apt-cache show firefox | grep Section Section: web 

Источник

Оцените статью
Adblock
detector