How to search files through all the packages available on Ubuntu

How to search files through all the packages available on Ubuntu

Step 1: install apt-file

sudo apt-get install apt-file

root@tutorialspots ~ # sudo apt-get install apt-file
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
  apache2-data apache2-utils
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  libapt-pkg-perl libexporter-tiny-perl liblist-moreutils-perl
  liblist-moreutils-xs-perl libregexp-assemble-perl
The following NEW packages will be installed:
  apt-file libapt-pkg-perl libexporter-tiny-perl liblist-moreutils-perl
  liblist-moreutils-xs-perl libregexp-assemble-perl
0 upgraded, 6 newly installed, 0 to remove and 48 not upgraded.
Need to get 293 kB of archives.
After this operation, 887 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 jammy/main amd64 libapt-pkg-perl amd64 0.1.40build2 [72.5 kB]
Get:2 jammy/main amd64 libexporter-tiny-perl all 1.002002-1 [36.2 kB]
Get:3 jammy/main amd64 liblist-moreutils-xs-perl amd64 0.430-2build2 [41.9 kB]
Get:4 jammy/main amd64 liblist-moreutils-perl all 0.430-2 [38.2 kB]
Get:5 jammy/universe amd64 libregexp-assemble-perl all 0.36-1.1 [76.4 kB]
Get:6 jammy/universe amd64 apt-file all 3.2.2 [27.6 kB]
Fetched 293 kB in 0s (1,653 kB/s)
Selecting previously unselected package libapt-pkg-perl.
(Reading database ... 73631 files and directories currently installed.)
Preparing to unpack .../0-libapt-pkg-perl_0.1.40build2_amd64.deb ...
Unpacking libapt-pkg-perl (0.1.40build2) ...
Selecting previously unselected package libexporter-tiny-perl.
Preparing to unpack .../1-libexporter-tiny-perl_1.002002-1_all.deb ...
Unpacking libexporter-tiny-perl (1.002002-1) ...
Selecting previously unselected package liblist-moreutils-xs-perl.
Preparing to unpack .../2-liblist-moreutils-xs-perl_0.430-2build2_amd64.deb ...
Unpacking liblist-moreutils-xs-perl (0.430-2build2) ...
Selecting previously unselected package liblist-moreutils-perl.
Preparing to unpack .../3-liblist-moreutils-perl_0.430-2_all.deb ...
Unpacking liblist-moreutils-perl (0.430-2) ...
Selecting previously unselected package libregexp-assemble-perl.
Preparing to unpack .../4-libregexp-assemble-perl_0.36-1.1_all.deb ...
Unpacking libregexp-assemble-perl (0.36-1.1) ...
Selecting previously unselected package apt-file.
Preparing to unpack .../5-apt-file_3.2.2_all.deb ...
Unpacking apt-file (3.2.2) ...
Setting up libapt-pkg-perl (0.1.40build2) ...
Setting up liblist-moreutils-xs-perl (0.430-2build2) ...
Setting up libexporter-tiny-perl (1.002002-1) ...
Setting up libregexp-assemble-perl (0.36-1.1) ...
Setting up liblist-moreutils-perl (0.430-2) ...
Setting up apt-file (3.2.2) ...
The system-wide cache is empty. You may want to run 'apt-file update'
as root to update the cache.
Processing triggers for man-db (2.10.2-1) ...
Scanning processes...
Scanning processor microcode...
Scanning linux images...

Running kernel seems to be up-to-date.

The processor microcode seems to be up-to-date.

No services need to be restarted.

No containers need to be restarted.

No user sessions are running outdated binaries.

No VM guests are running outdated hypervisor (qemu) binaries on this host.

Step 2: update apt-file

sudo apt-file update

root@tutorialspots ~ # sudo apt-file update
Hit:1 jammy InRelease
Get:2 jammy-updates InRelease [119 kB]
Hit:3 jammy InRelease
Hit:4 jammy-backports InRelease
Get:5 jammy-security InRelease [110 kB]
Hit:6 jammy InRelease
Get:7 jammy-updates InRelease [119 kB]
Hit:8 jammy-backports InRelease
Get:9 jammy amd64 Contents (deb) [46.9 MB]
Get:10 jammy-security InRelease [110 kB]
Get:11 jammy amd64 Contents (deb) [46.9 MB]
Get:12 jammy-updates/main amd64 Packages [1,611 kB]
Get:13 jammy-updates/main Translation-en [303 kB]
Get:14 jammy-security/main amd64 Packages [1,394 kB]
Get:15 jammy-updates amd64 Contents (deb) [106 MB]
Get:16 jammy-security/main Translation-en [243 kB]
Get:17 jammy-security amd64 Contents (deb) [103 MB]
Get:18 jammy-updates/universe amd64 Packages [1,071 kB]
Get:19 jammy-updates/universe Translation-en [245 kB]
Get:20 jammy-backports amd64 Contents (deb) [730 kB]
Get:21 jammy-security/main amd64 Packages [1,394 kB]
Get:22 jammy-security/main Translation-en [243 kB]
Get:23 jammy-security amd64 Contents (deb) [103 MB]
Get:24 jammy-security/universe amd64 Packages [849 kB]
Get:25 jammy-security/universe Translation-en [163 kB]
Get:26 jammy-security/universe amd64 Packages [849 kB]
Get:27 jammy-security/universe Translation-en [163 kB]
Get:28 jammy-updates/main amd64 Packages [1,611 kB]
Get:29 jammy-updates/main Translation-en [303 kB]
Get:30 jammy-updates amd64 Contents (deb) [106 MB]
Get:31 jammy-updates/universe amd64 Packages [1,071 kB]
Get:32 jammy-updates/universe Translation-en [245 kB]
Get:33 jammy-backports amd64 Contents (deb) [730 kB]
Fetched 526 MB in 41s (13.0 MB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
50 packages can be upgraded. Run 'apt list --upgradable' to see them.

Step 3: find files: example find file saslpasswd2

apt-file search saslpasswd2


root@tutorialspots ~ # apt-file search saslpasswd2
sasl2-bin: /usr/sbin/saslpasswd2
sasl2-bin: /usr/share/man/man8/saslpasswd2.8.gz

Leave a Reply