18

I use a lot of different package managers to install various pieces of software on my PC: apt, apt-get, pip, snap, basically whatever the online documentation recommends. How do I tell which package manager I used to install a specific program? I'd like to update it using the same method.

3
  • 1
    Suggestion: When you use some online guide to install random software, keep notes on what you installed, when, why, and a link to those instructions. Someday you will need to retrace your steps for maintenance, troubleshooting, or rebuilding.
    – user535733
    Apr 24, 2022 at 17:27
  • 3
    Aside: apt and apt-get are the two different front ends for the same package management system - i.e. you can use them interchangeably for managing the same package. Apr 25, 2022 at 10:42
  • 3
    Your intuition is good. This is precisely the reason that you should only ever use one package manager. Unfortunately, people often only package software for their "favourite" package manager, and everyone else is stuck until a port is written. I encourage you to write those ports! Apr 25, 2022 at 12:44

2 Answers 2

21

You could try the following to give you clues on which package manager was used:

snap list

pip list

apt list --installed

In the case of apt or apt-get, the list may be very long, so you could use grep to filter the results. eg. apt list --installed | grep firefox

2
  • 4
    The "quiet" option can be used with apt like so apt -qq list --installed firefox to print only the specified package name if it is installed.
    – Raffa
    Apr 24, 2022 at 17:39
  • 1
    Also, please keep in mind that pip list may give different outputs depending on the version of python that is currently "active" (first in $PATH). Even a vanilla Ubuntu (without any virtualenvs or additional python versions) will have at least 2 python versions (v2 and v3) installed.
    – arielf
    Apr 29, 2022 at 22:44
-3

Lazy method: Search your shell history for the line that actually installed the package.

2
  • 4
    Very unlikely to work unless you entered less than 500 commands since the install (standard cutoff for .bash_history; details may vary depending on shell and config) Apr 25, 2022 at 11:25
  • /etc/skel/.bashrc:HISTSIZE=1000 - not much better though.
    – mow
    Apr 26, 2022 at 13:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .