Updated: 11 October 2026 · Applies to: Ubuntu 26.04 (apt 3.2.0) and Ubuntu 24.04 (apt 2.8.3), tested; listing and holds also tested on Debian 13 (apt 3.0.3)
To search for a package on Ubuntu, refresh the package lists and run apt search with a keyword. It searches package names and descriptions in every repository your server uses. To see every available package, use apt list; to stop a package from being upgraded, put it on hold with apt-mark hold:
sudo apt update apt search nginx # names and descriptions apt search --names-only '^nginx' # names only apt show nginx # details of one package apt list # every available package sudo apt-mark hold nginx # keep nginx at its current version apt-mark showhold # list held packages sudo apt-mark unhold nginx # allow updates again
Search for a package (Ubuntu package search)
- Refresh the lists first, so the search sees what the repositories offer now:
sudo apt update. A search on old lists can miss new packages or show old versions. - Search names and descriptions. Each result shows the name, the repository suite, the version and the architecture, then the description. Lab output from Ubuntu 26.04, which found 58 packages for
nginx:$ apt search nginx Sorting... Full Text Search... elpa-nginx-mode/resolute 1.1.10-1build1 all major mode for editing nginx config files golang-github-nginxinc-nginx-plus-go-client-dev/resolute 3.0.1-1 all client for NGINX Plus API for Go (library) libnginx-mod-http-auth-pam/resolute 1:1.5.5-4build3 amd64 PAM authentication module for Nginx ...
- Narrow it down. The search term is a regular expression, so
^means "starts with" and$"ends with". Several terms must all match:$ apt search --names-only '^nginx$' nginx/noble-updates,noble-security 1.24.0-2ubuntu7.18 amd64 small, powerful, scalable web/proxy server $ apt search lightweight 'web server' caddy/resolute 2.6.2-14 amd64
(The first result is from Ubuntu 24.04; output shortened.) - For one line per package, which is easier to read and to use in scripts, use
apt-cache search. For example, to see which PHP-FPM version your release has (Ubuntu 26.04 below; Ubuntu 24.04 answeredphp8.3-fpm):$ apt-cache search --names-only '^php[0-9.]+-fpm$' php8.5-fpm - server-side, HTML-embedded scripting language (FPM-CGI binary)
- Check a package before you install it.
apt show nginxprints the version, section, size, dependencies, description and the repository (APT-Sources);apt-cache policy nginxshows the installed and candidate versions and where each comes from:$ apt-cache policy nginx nginx: Installed: (none) Candidate: 1.28.3-2ubuntu1.11 Version table: 1.28.3-2ubuntu1.11 500 500 http://archive.ubuntu.com/ubuntu resolute-updates/main amd64 Packages 500 http://security.ubuntu.com/ubuntu resolute-security/main amd64 Packages 1.28.3-2ubuntu1 500 500 http://archive.ubuntu.com/ubuntu resolute/main amd64 Packages
Find which package contains a command or file
Package names often differ from command names. With Ubuntu’s command-not-found package installed, typing a missing command tells you which package to install. In our test:
Command 'dig' not found, but can be installed with: apt install bind9-dnsutils Command 'ifconfig' not found, but can be installed with: apt install net-tools
For any file, also ones that are not commands, use apt-file. It searches the contents of all available packages:
$ sudo apt install apt-file $ sudo apt-file update $ apt-file search --regexp '/usr/bin/dig$' bind9-dnsutils: /usr/bin/dig $ apt-file list bind9-dnsutils | head -4 bind9-dnsutils: /usr/bin/delv bind9-dnsutils: /usr/bin/dig bind9-dnsutils: /usr/bin/mdig bind9-dnsutils: /usr/bin/nslookup
For a file that is already installed, dpkg -S /usr/bin/apt-file answers apt-file: /usr/bin/apt-file without any download.
Search Ubuntu packages online
packages.ubuntu.com searches package names, descriptions or source package names for one Ubuntu release (for example resolute for 26.04 or noble for 24.04), and its "Search the contents of packages" form finds the package that ships a file. This helps to check whether a package exists in your release before you change anything on the server. For Debian, use packages.debian.org.
Snap packages are a separate system: according to the Snapcraft documentation, snap find "media player" searches snap names and descriptions, and snap info NAME shows the channels and versions.
Unable to locate package
When apt cannot find a name, apt 3 on Ubuntu 26.04 prints Error: Unable to locate package NAME; apt 2.8 on 24.04 and apt-get print E: Unable to locate package NAME. Check, in this order:
- The spelling, with
apt search --names-only. - That you ran
sudo apt updateon this server at least once. - That the package exists in your release on packages.ubuntu.com. Packages are added and removed between releases.
- That the right repository is enabled. apt only searches the repositories listed in
/etc/apt/sources.list.d/. On Ubuntu 26.04 our test server had:$ grep -h -E '^(URIs|Suites|Components):' /etc/apt/sources.list.d/*.sources URIs: http://archive.ubuntu.com/ubuntu/ Suites: resolute resolute-updates resolute-backports Components: main universe restricted multiverse URIs: http://security.ubuntu.com/ubuntu/ Suites: resolute-security Components: main universe restricted multiverse
Ifuniverseis missing, or the software needs a vendor repository or PPA, see how to list, add, enable and remove repositories on Ubuntu.
List available packages (the Ubuntu package list)
apt list prints every package the enabled repositories offer: on our test servers 78,922 on Ubuntu 26.04 and 87,454 on Ubuntu 24.04. Use a pattern in quotes and apt list -a for all versions of one package:
$ apt list "nginx*" Listing... nginx-common/resolute-updates,resolute-security 1.28.3-2ubuntu1.11 all nginx-confgen/resolute 2.2-1build1 amd64 nginx-core/resolute-updates,resolute-security 1.28.3-2ubuntu1.11 all ... $ apt list -a openssl openssl/resolute-updates,resolute-security 3.5.5-1ubuntu3.7 amd64 openssl/resolute 3.5.5-1ubuntu3 amd64
apt-get has no list command (apt-get list fails with E: Invalid operation list). Its family tool apt-cache does the job: apt-cache pkgnames prints all names, apt-cache madison nginx all versions with their mirror. When you pipe apt into another command it warns apt does not have a stable CLI interface. Use with caution in scripts.; in scripts, prefer apt-cache and dpkg-query.
apt list --installed # everything installed apt list --manual-installed # only what was installed on purpose apt list --upgradable # updates waiting after apt update
More ways to count and export installed packages: list installed packages on Ubuntu and Debian.
Hold a package (apt hold)
A hold stops APT from upgrading, removing or automatically installing a package, for example to keep a tested PHP, database or kernel version.
- Hold one or more packages:
$ sudo apt-mark hold libssl3t64 libssl3t64 set on hold.
- Check:
apt-mark showholdlists the holds, and indpkg -la held package starts withhi. - Upgrade as usual. Ubuntu 24.04 lists the held package under
The following packages have been kept back:; Ubuntu 26.04 and Debian 13 list it underNot upgrading:. - Remove the hold:
sudo apt-mark unhold libssl3t64(Canceled hold on libssl3t64.).
From our tests: a hold can also keep back packages that need the matching version (holding libaudit-common kept back libaudit1); unattended upgrades skip held packages (pkg openssl is on hold); and apt install -y on a held package stops with Held packages were changed and -y was used without --allow-change-held-packages. To keep the kernel series, hold linux-generic, linux-image-generic and linux-headers-generic, and unhold them later so security fixes arrive again.
Not every "kept back" package is held: according to Ubuntu, phased updates reach machines in stages and the message clears by itself. To pin or block versions in other ways, see lock package updates with APT; to install an exact version, see install a specific package version with apt; for a safe update routine, see update all packages on Linux safely.
Official documentation: apt, apt-mark, apt-file and Ubuntu: apt upgrade and phased updates.
Ucartz services for this topic
- KVM VPS hosting: NVMe SSD and full root access, with Free Basic Managed Support.
- Unmanaged dedicated servers: full root access and free IPMI KVM, with Free Basic Managed Support.
- Linux server management: hardening, patching, monitoring and automation for Ubuntu, Debian, RHEL and AlmaLinux.
