Listing all installed packages linux

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.

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?

Читайте также:  Rdp сервер на linux remmina

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.

@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.

Читайте также:  Linux пролистать терминал вверх

Источник

How to List Installed Packages on Ubuntu and Debian-based Linux Distributions

So you installed Ubuntu and started using it extensively. Somewhere down the line, you are bound to lose the track of the software that you had installed over the time .

That’s perfectly normal. No one expects you to remember all the packages installed on your system. But the question arises, how to know what packages have been installed? How to see the installed packages?

To list all the installed packages using apt:

apt list –installed

Read the rest of the tutorial to know more about other ways and some more tips to fine tune your search for installed packages.

List installed packages in Ubuntu and Debian

List installed Packages

If you use apt command extensively, you would probably expect a command like apt list installed packages. You are not entirely wrong here.

While apt-get command doesn’t have a straightforward option like apt-get list installed packages, apt has a command for this.

This will list all the packages that have been installed using apt. It will also list the packages that were installed as a dependency. Which means that not only you’ll have the applications you installed, you’ll also have a huge list of libraries and other packages that you didn’t install directly.

List installed packages in Ubuntu with apt command

Check whether a specific package is installed in Ubuntu

Since the list of installed packages is a huge one, it would be a better idea to use grep and filter the output for a certain package.

apt list --installed | grep program_name

A better way is to use this command:

apt -qq list program_name --installed

Both q options are for quiet mode. And this way, it only looks for programs that are installed.

Note that the above method also lists the applications installed with .deb files. That’s cool, isn’t it?

Other ways to check installed packages in Ubuntu/Debian

If you have read my apt vs apt-get comparison article, you probably already know that both apt and apt-get basically use dpkg . This means you can use dpkg command to list all the installed packages in Debian.

You can filter the output with grep again to search for a specific package.

Listing installed packages with dpkg command

So far, you have dealt with applications installed with Debian’s package manager. What about Snap and Flatpak applications? How to list them because they are not accessible with apt and dpkg?

To show all the Snap packages installed on your system, use this command:

Читайте также:  Linux mount nfs centos

Snap list also indicates which applications are from a verified publisher with a green tick.

List installed packages with snap

To list all the Flatpak packages installed on your system, use this:

Let me summarize it for you.

To list packages using apt command:

apt list –installed

To list packages using dpkg command:

dpkg -query -l

To list Snap packages installed on your system:

To list Flatpak packages installed on your system:

flatpak list

List the recently installed packages

So far you saw the list of installed packages in alphabetical order. What if you want to see the packages that have been installed recently?

Thankfully, a Linux system keeps a log of everything that happens in your system. You can refer to the logs to see the recently installed packages.

There are a couple of ways to do this. You can either use the dpkg command’s log or the apt command’s log.

You’ll have to use grep command to filter the result to list the installed packages only.

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

This will list all the packages including the dependencies that were installed recently on your system along with the time of installation.

2019-02-12 12:41:42 install ubuntu-make:all 16.11.1ubuntu1
2019-02-13 21:03:02 install xdg-desktop-portal:amd64 0.11-1
2019-02-13 21:03:02 install libostree-1-1:amd64 2018.8-0ubuntu0.1
2019-02-13 21:03:02 install flatpak:amd64 1.0.6-0ubuntu0.1
2019-02-13 21:03:02 install xdg-desktop-portal-gtk:amd64 0.11-1
2019-02-14 11:49:10 install qml-module-qtquick-window2:amd64 5.9.5-0ubuntu1.1
2019-02-14 11:49:10 install qml-module-qtquick2:amd64 5.9.5-0ubuntu1.1
2019-02-14 11:49:10 install qml-module-qtgraphicaleffects:amd64 5.9.5-0ubuntu1

You can also use the history of apt command. This will show only the programs that you installed using apt command. It won’t show the dependencies installed with it, though the details are present in the logs. Sometimes, you just want to see that, right?

grep " install " /var/log/apt/history.log

The output should be something like this:

Commandline: apt install pinta
Commandline: apt install pinta
Commandline: apt install tmux
Commandline: apt install terminator
Commandline: apt install moreutils
Commandline: apt install ubuntu-make
Commandline: apt install flatpak
Commandline: apt install cool-retro-term
Commandline: apt install ubuntu-software

List recently installed packages

The history log of apt is quite useful because it shows the time when the apt command was run, the user who ran the command and the packages that were installed by a command.

Bonus Tip: Show installed applications in Software Center

If you are not comfortable with the terminal and the commands, you still has a way to see the applications installed on your system.

You can open the Software Center and click on the Installed tab. You’ll see the list of applications that have been installed on your system.

List Installed Software in Ubuntu Software Center

It won’t show the libraries and other command line stuff though but perhaps you don’t want to see that as you are more GUI centric. Otherwise, you can always use the Synaptic Package Manager.

I hope this quick little tutorial helped you to see the list of installed packages on Ubuntu and Debian based distributions.

If you have questions or suggestions to improve this article, please leave a comment below.

Источник

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