Contact Us

Got questions, inquiries, or opportunities for collaboration? We are just a message away!

Find Package Installation Method On Linux

When managing software on Linux systems, various package managers are commonly used, including APT, DNF, Pacman, Snap, and Flatpak. Each of these tools offers a unique method for installing and managing software, and they can often coexist on the same system. Understanding the source of installation can be helpful for troubleshooting, updating, or uninstalling the package, maintaining consistency, and ensuring the smooth operation of a system:

  • Troubleshooting Conflicts: Sometimes the same application exists in multiple formats (for example, VSCode installed via APT and also as a Snap). Identifying which one is actually in use helps avoid conflicts and confusion.
  • Consistent Updates: Each package manager maintains its own update mechanism. If you don't know the source, you might update one version while another remains outdated.
  • System Cleanup: When freeing up space or decluttering, knowing whether a package came from APT, Flatpak, or Snap ensures you remove it correctly and avoid orphaned files.
  • Automation and Configuration Management: System administrators often script installations to automate tasks. Verifying package sources helps ensure reproducibility across systems and environments.

Distribution-Specific Package Managers

NOTE: Replace <package_name> with the name of the package you are checking.


APT (Debian/Ubuntu)

To check if a package was installed using apt:

$ apt list --installed | grep <package_name>

or for a more precise check:

$ dpkg-query -W -f='${Status}' <package_name>

or

$ dpkg -l | grep <package_name>

NOTE: dpkg -l lists packages that are known to the system's package database, which means:

  • Installed packages (fully installed, marked as ii)
  • Partially installed or removed packages (like rc, un, iF, etc.)
  • Not packages that have never been installed - those don't appear at all

Look for these flags for installation status:

  • ii = installed
  • rc = removed, but configuration files remain
  • un = not installed, but seen in the dpkg database (rarely shown)

For example, to check if curl was installed with apt:

$ apt list --installed | grep curl

curl/noble-updates,noble-security,now 8.5.0-2ubuntu10.6 amd64 [installed]
libcurl3t64-gnutls/noble-updates,noble-security,now 8.5.0-2ubuntu10.6 amd64 [installed,automatic]
libcurl4-openssl-dev/noble-updates,noble-security,now 8.5.0-2ubuntu10.6 amd64 [installed]
libcurl4t64/noble-updates,noble-security,now 8.5.0-2ubuntu10.6 amd64 [installed,automatic]

# or

$ dpkg-query -W -f='${Status}' curl

install ok installed

# or

$ dpkg -l | grep curl

ii  curl                              8.5.0-2ubuntu10.6        amd64        command line tool for transferring data with URL syntax
ii  libcurl3t64-gnutls:amd64          8.5.0-2ubuntu10.6        amd64        easy-to-use client-side URL transfer library (GnuTLS flavour)
ii  libcurl4-openssl-dev:amd64        8.5.0-2ubuntu10.6        amd64        development files and documentation for libcurl (OpenSSL flavour)
ii  libcurl4t64:amd64                 8.5.0-2ubuntu10.6        amd64        easy-to-use client-side URL transfer library (OpenSSL flavour)

DNF/YUM (Fedora/RHEL/CentOS)

To check if a package was installed using dnf:

$ dnf list installed <package_name>

or for older systems using YUM:

$ yum list installed <package_name>

For example, to check if vim was installed with dnf:

$ dnf list installed vim

Installed Packages
vim.x86_64    2:9.0.2153-1.fc39    @updates

Pacman (Arch Linux/Manjaro)

To check if a package was installed using pacman:

$ pacman -Qi <package_name>

or to list all installed packages:

$ pacman -Q | grep <package_name>

For example, to check if firefox was installed:

$ pacman -Qi firefox

Name            : firefox
Version         : 130.0-1
Description     : Standalone web browser from mozilla.org
Architecture    : x86_64
...

PPA (Personal Package Archives)

To check if a package was installed from a PPA:

$ apt-cache policy <package_name>

For example, to check if wget was installed from a PPA:

$ apt-cache policy wget

wget:
  Installed: 1.21.4-1ubuntu4.1
  Candidate: 1.21.4-1ubuntu4.1
  Version table:
 *** 1.21.4-1ubuntu4.1 500
        500 http://archive.ubuntu.com/ubuntu noble-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu noble-security/main amd64 Packages
        100 /var/lib/dpkg/status
     1.21.4-1ubuntu4 500
        500 http://archive.ubuntu.com/ubuntu noble/main amd64 Packages

Zypper (openSUSE)

To check if a package was installed using zypper:

$ zypper se -i <package_name>

or

$ rpm -qa | grep <package_name>

For example, to check if git was installed with zypper:

$ zypper se -i git

Loading repository data...
Reading installed packages...

S | Name | Summary                     | Type
--+------+-----------------------------+--------
i | git  | Fast, scalable, distributed | package

Universal Package Managers

Snap

To check if a package was installed using snap:

$ snap list | grep <package_name>

or to search for an exact match:

$ snap list <package_name>

For example, to check if firefox was installed with snap:

$ snap list | grep firefox
firefox        130.0.0-1        4955        latest/stable/…        mozilla**

Flatpak

To check if a package was installed using flatpak:

$ flatpak list | grep <package_name>

or to list only applications:

$ flatpak list --app | grep <package_name>

For example, to check if steam was installed with flatpak:

$ flatpak list | grep com.valvesoftware.Steam

Steam   com.valvesoftware.Steam 1.0.0.79    stable  system

Homebrew (macOS/Linux)

To check if a package was installed using Homebrew:

$ brew list | grep <package_name>

or for a specific package:

$ brew list <package_name>

or for cask macOS applications:

$ brew list --cask <package_name>

For example, to check if python was installed with homebrew:

$ brew list | grep python

[email protected]

AppImage

AppImages are portable applications that don't require installation. To find AppImage files:

$ find ~/Applications ~/Downloads ~/.local/bin /opt -maxdepth 2 -iname "*<package_name>*.appimage" 2>/dev/null

For example, to search for a Kdenlive AppImage within user's Applications and Downloads subdirectories:

$ find ~/Applications ~/Downloads -iname "*kdenlive*.appimage"

/home/user/Applications/Kdenlive-24.08.1-x86_64.AppImage

Checking For Multiple Sources

It's not unusual for the same application to be installed from multiple sources. For instance, one version may be from APT, while another could come from Snap or Flatpak. This situation can create confusion about which version of the system is currently in use.

To see which version of a program is currently being executed, use:

$ which <package_name>

or

$ type -a <package_name>

or

$ command -a <package_name>

For example, to check which VSCode is used on the system:

$ which code

/usr/bin/code

# or

$ type -a code

code is /usr/bin/code
code is /bin/code

# or

command -a code

/usr/bin/code
/bin/code

You can also check what's currently running by inspecting the process. This can help determine which installation source the system is actively using:

ps -p "$(pgrep -x <package_name> | paste -sd, -)" -o comm,pid,cmd

For example, to check the running code process:

ps -p "$(pgrep -x code | paste -sd, -)" -o comm,pid,cmd

COMMAND       PID   CMD
code        12047   /usr/share/code/code .
code        12061   /usr/share/code/code --type=zygote --no-zygote-sandbox
code        12063   /usr/share/code/code --type=zygote
code        12221   /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --enable-crash-rep

Checking Package Versions & Update Sources

To verify the source of updates or identify the repository a package belongs to, you can use the following commands. These commands display both the installed version of the package and the candidate version available for update, along with the repository or channel from which it originates. This information helps confirm whether updates will come from the official distribution source, a Personal Package Archive (PPA), or a third-party repository.

APT

$ apt-cache policy <package_name>

DNF

$ dnf info <package_name>

Flatpak

$ flatpak info <package_name>

Homebrew

$ brew info <package_name>

Pacman

$ pacman -Si <package_name>

Snap

$ snap info <package_name>

YUM

$ yum info <package_name>

Zypper

$ zypper info <package_name>

General Approach

If you're unsure which package manager was used, you can check all of the above methods using an automated script below, which will gives a quick overview of whether the package was installed using APT, DNF, Pacman, Zypper, Snap, Flatpak, Homebrew, or exists as an AppImage. The script automatically detects which package managers are available on the system and only checks those that are present. It provides color-coded output showing whether the package is installed (✓) or not installed (✗) for each available package manager.

  • Save the script as check-package-source.sh
  • Make the script executable: $ chmod +x check-package-source.sh
  • Run the script: $ ./check-package-source.sh
  • The script will prompt you to enter the package name and will check which package manager was used

Supported Package Managers

  • AppImage (Portable applications)
  • APT (Debian, Ubuntu, Linux Mint)
  • DNF/YUM (Fedora, RHEL, CentOS, Rocky Linux)
  • Flatpak (Universal, cross-distribution)
  • Homebrew (macOS and Linux)
  • Pacman (Arch Linux, Manjaro, EndeavourOS)
  • Snap (Universal, cross-distribution)
  • Zypper (openSUSE, SUSE Linux Enterprise)
#!/bin/bash

# Multi-package manager installer checker
# Supports: AppImage, APT, DNF/YUM, Flatpak, Homebrew, Pacman, Snap, Zypper

# Color codes for better visibility
GREEN='\033[0;32m'
RED='\033[0;31m'
YELLOW='\033[1;33m'
NC='\033[0m' # no color

# Ask for the package name
read -p "Enter the package name: " package_name

if [[ -z "$package_name" ]]; then
    echo -e "${RED}Error: Package name cannot be empty${NC}"
    exit 1
fi

echo -e "\n${YELLOW}Searching for: $package_name${NC}\n"

# Check if a command exists
command_exists() {
    command -v "$1" >/dev/null 2>&1
}

found=false

# Check for AppImage (basic check in common locations)
if command_exists find; then
    echo "Checking for AppImage files:"
    appimage_dirs=("$HOME/Applications" "$HOME/.local/bin" "/opt" "$HOME/Downloads")
    for dir in "${appimage_dirs[@]}"; do
        if [[ -d "$dir" ]]; then
            if find "$dir" -maxdepth 2 -iname "*${package_name}*.appimage" 2>/dev/null | grep -q .; then
                echo -e "  ${GREEN}${NC} Found AppImage matching $package_name in $dir"
                found=true
                break
            fi
        fi
    done
    if [[ "$found" == false ]]; then
        echo -e "  ${RED}${NC} No AppImage found for $package_name"
    fi
fi

# Check APT (Debian/Ubuntu)
if command_exists dpkg-query; then
    echo "Checking APT (Debian/Ubuntu):"
    if dpkg-query -W -f='${Status}' "$package_name" 2>/dev/null | grep -q "install ok installed"; then
        echo -e "  ${GREEN}${NC} $package_name is installed via APT"
        found=true
    else
        echo -e "  ${RED}${NC} $package_name is NOT installed via APT"
    fi
fi

# Check DNF/YUM (Fedora/RHEL/CentOS)
if command_exists dnf; then
    echo "Checking DNF (Fedora/RHEL):"
    if dnf list installed "$package_name" >/dev/null 2>&1; then
        echo -e "  ${GREEN}${NC} $package_name is installed via DNF"
        found=true
    else
        echo -e "  ${RED}${NC} $package_name is NOT installed via DNF"
    fi
elif command_exists yum; then
    echo "Checking YUM (RHEL/CentOS):"
    if yum list installed "$package_name" >/dev/null 2>&1; then
        echo -e "  ${GREEN}${NC} $package_name is installed via YUM"
        found=true
    else
        echo -e "  ${RED}${NC} $package_name is NOT installed via YUM"
    fi
fi

# Check Flatpak
if command_exists flatpak; then
    echo "Checking Flatpak:"
    if flatpak list --app | grep -qi "$package_name"; then
        echo -e "  ${GREEN}${NC} $package_name is installed via Flatpak"
        found=true
    else
        echo -e "  ${RED}${NC} $package_name is NOT installed via Flatpak"
    fi
fi

# Check Homebrew (macOS/Linux)
if command_exists brew; then
    echo "Checking Homebrew:"
    if brew list --formula "$package_name" >/dev/null 2>&1 || brew list --cask "$package_name" >/dev/null 2>&1; then
        echo -e "  ${GREEN}${NC} $package_name is installed via Homebrew"
        found=true
    else
        echo -e "  ${RED}${NC} $package_name is NOT installed via Homebrew"
    fi
fi

# Check Pacman (Arch Linux)
if command_exists pacman; then
    echo "Checking Pacman (Arch Linux):"
    if pacman -Qi "$package_name" >/dev/null 2>&1; then
        echo -e "  ${GREEN}${NC} $package_name is installed via Pacman"
        found=true
    else
        echo -e "  ${RED}${NC} $package_name is NOT installed via Pacman"
    fi
fi

# Check Snap
if command_exists snap; then
    echo "Checking Snap:"
    if snap list "$package_name" >/dev/null 2>&1; then
        echo -e "  ${GREEN}${NC} $package_name is installed via Snap"
        found=true
    else
        echo -e "  ${RED}${NC} $package_name is NOT installed via Snap"
    fi
fi

# Check Zypper (openSUSE)
if command_exists zypper; then
    echo "Checking Zypper (openSUSE):"
    if zypper se -i "$package_name" 2>/dev/null | grep -q "^i.*|.*$package_name"; then
        echo -e "  ${GREEN}${NC} $package_name is installed via Zypper"
        found=true
    else
        echo -e "  ${RED}${NC} $package_name is NOT installed via Zypper"
    fi
fi

# Summary
echo ""
if [[ "$found" == true ]]; then
    echo -e "${GREEN}✓ Package found in at least one package manager${NC}"
else
    echo -e "${RED}✗ Package not found in any package manager${NC}"
fi

GUI Alternatives

If you prefer graphical tools, several Linux distributions provide interfaces that make it easier to identify how software was installed:

  • GNOME Software - Used by Ubuntu, Fedora, and others; lists installation sources (e.g., APT, Snap, or Flatpak).
  • KDE Discover - Used by Kubuntu, KDE Neon, and openSUSE; displays application installation status and source.
  • Synaptic Package Manager - A classic GUI for Debian-based systems that lets you browse, install, update, and remove APT packages.

These tools are handy when managing multiple formats simultaneously or when you want a quick visual overview of installed software without using the terminal.


Troubleshooting

If no package manager reports that the software is installed, there are several possible explanations.

Manual or Local Installation

The application might have been built and installed manually from source or copied into /usr/local/bin or /opt:

$ which <package_name>
$ ls -l $(which <package_name>)

Binary or Script in PATH

Some programs are just standalone binaries or shell scripts downloaded manually. You can check the directory and file type:

$ file $(which <package_name>)

Flatpak or Snap not in PATH

On some systems, paths like /snap/bin or /var/lib/flatpak/exports/bin might not be in the $PATH. Add them if necessary to detect installed apps.

Containerized Applications

The package may be running inside a container or virtualized environment:

$ docker ps | grep <package_name>
$ podman ps | grep <package_name>

Permissions

If running as a non-root user, some package managers (like dnf or zypper) may not list system-wide packages unless run with sudo.


Further Reading & References