Identify The Debian/Ubuntu Parcel Containing A Command/Filename

Consider this scenario: yous read virtually this first-class Linux dominance that is novel to you. You rapidly endeavour it out, as well as uncovering that the dominance is non found. Before yous tin install the command, yous must start uncovering the cite of the packet that provides it.

Below, nosotros outline the instructions to search for a packet inwards Debian/Ubuntu. My next post volition create the same for Fedora/Red Hat.

Debian offers multiple command-line tools to search for a package, as well as which 1 to piece of work depends on how broad yous desire to search.

Do yous desire to search inwards the installed packet base of operations only, or inwards the entire liberate repository? Do yous desire to gibe the keywords against the file path only, or against the packet description every bit well?

dpkg

Given a file path pattern, the dpkg -S dominance searches with installed packages only. The blueprint is used to gibe the file path, but non the packet description.

$ dpkg -S iostat sysstat: /usr/bin/nfsiostat sysstat: /usr/share/man/man1/iostat.1.gz sysstat: /usr/share/man/man1/nfsiostat.1.gz linux-headers-3.2.0-4-common: /usr/src/linux-headers-3.2.0-4-common/include/linux/nfs_iostat.h sysstat: /usr/bin/iostat sysstat: /usr/share/man/man1/cifsiostat.1.gz sysstat: /usr/bin/cifsiostat nfs-common: /usr/sbin/nfsiostatg nfs-common: /usr/share/man/man8/nfsiostat.8.gz

Note that the inwards a higher house search returns to a greater extent than results than nosotros want. This is because the enquiry automatically adds the wildcard grapheme "*" earlier as well as later your search keyword iostat. Hence it matches /usr/bin/nfsiostat every bit good every bit /usr/share/man/man1/iostat.1.gz.

If yous are certain virtually the dominance name, motion into it with the next wildcard blueprint to avoid the extra output:

$ dpkg -S */iostat$* sysstat: /usr/bin/iostat

The inwards a higher house output concludes that the sysstat packet contains the iostat command.

If the effect is path non flora matching pattern, it merely agency that the dominance is non inwards the installed packet base. Use apt-file or apt-cache to expand your search.

apt-file

To install apt-file:

$ sudo apt-get update $ sudo apt-get install apt-file

apt-file builds its ain database to index files provided past times packages. Before your start search - as well as periodically later that - yous must update the database every bit follows:

$ apt-file update Downloading consummate file http://deb.vanvps.com/debian/dists/wheezy/main/Contents-amd64.gz % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 20.4M 100 20.4M 0 0 372k 0 0:00:56 0:00:56 --:--:-- 373k Ignoring root without Contents File: http://security.debian.org/dists/wheezy/updates/main/Contents-amd64.gz Downloading Index http://deb.vanvps.com/debian/dists/wheezy-updates/main/Contents-amd64.diff/Index: % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 1057 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 Index is up-to-date.

The apt-file update dominance reads the /etc/apt/sources.list file to position the repositories used past times your system, as well as the corresponding mirror sites for downloading packages. For instance, the next job is inwards sources.list:

 deb http://deb.vanvps.com/debian/ wheezy principal  

Then, it downloads, from the chosen mirror site, the architecture-specific (amd64) Contents file (http://deb.vanvps.com/debian/dists/wheezy/main/Contents-amd64.gz). The Contents file lists all files inwards all packages of the selected liberate (wheezy) as well as archive area (main).

Now that the database is up-to-date, yous are create to create the actual search:

$ apt-file search -x /pdfcrop$ texlive-extra-utils: /usr/bin/pdfcrop

With the -x parameter, the search string is treated every bit a regular expression. Therefore, the "$" grapheme is interpreted every bit "end of line" instead of literally every bit the dollar sign.

apt-cache

$ sudo apt-get update $ apt-cache search 2ping 2ping - Ping utility to create upwardly one's heed directional packet loss texlive-extra-utils - TeX Live: TeX auxiliary programs

The apt-cache search dominance searches the apt cache database for the given blueprint (2ping). Before the search, update the apt cache database with apt-get update. The update dominance reads the /etc/apt/sources.list file, as well as updates packet information for the repositories specified inwards the file.

By default, apt-cache matches the input blueprint (2ping) against both packet names as well as packet descriptions stored inwards the apt cache. Note that the inwards a higher house search returns the texlive-extra-utils packet because a gibe is flora inwards the packet description. To sentiment the packet description, run the apt-cache show command:

$ apt-cache present texlive-extra-utils

If the --names-only parameter is specified to apt-cache search, exclusively the packet cite is matched (and the description is not).

$ apt-cache search --names-only 2ping 2ping - Ping utility to create upwardly one's heed directional packet loss

The next article discusses how yous hit the same chore inwards Fedora, as well as whatsoever RPM-based distribution.

Berlangganan update artikel terbaru via email:

0 Response to "Identify The Debian/Ubuntu Parcel Containing A Command/Filename"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel