Linux which package provides file

How to Identify the Parent Package Name of the Installed Sub Package Name

I can understand what’s in your mind when you are reading this article title because I felt the same while seeing this mail. We got this request from one of our regular reader, requesting us to write an article about this topic. Yes, we got some time today to write more about this topic.

Don’t get panic while seeing the title. It’s very important article and I’m really happy to write up this because It will help many users to understand about this topic.

In Linux many utilities are incorporate with single parent package based on the purpose and usage. You should know the parent package name if you would like to install any of the sub package in that.

In this case how to find the parent package name? Yes, it’s not a big deal, We are hear to help you out on this.

You may get few of the below questions in your mind while start reading this article

  • Finding out what package a command came from?
  • How to find commands associated with a package?
  • Find Out What Package Provides a File?
  • How to find which package holds a file?
  • How To Check Whether The sub package is installed or not? If it’s installed then What is the Parent package name?

I can list out few of the package group that I know.

  • coreutils : The GNU Core Utilities are the basic file, shell and text manipulation utilities of the GNU operating system.
  • sysstat : The sysstat utilities are a collection of performance monitoring tools for Linux. These include sar, sadf, mpstat, iostat, tapestat, pidstat, cifsiostat and sa tools.
  • iproute2 : iproute2 is a collection of userspace utilities for controlling and monitoring various aspects of networking in the Linux kernel. It contains ip, ss, bridge, rtacct, rtmon, tc, ctstat, lnstat, nstat, routef, routel, rtstat, tipc, arpd and devlink
  • procps-ng : The procps package contains a set of system utilities that provide system information. Procps includes ps, free, skill, pkill, pgrep, snice, tload, top, uptime, vmstat, w, watch and pwdx.

Scenario:

I want to install sar package on my system, how to install it?

Step-1:

First, I will check whether the package is available or not in the distribution official repository by running the appropriate package manager commands.

Run the Yum Package Manager command to get the information about the package on RHEL/CentOS Systems.

Run the DNF Package Manager command to get the information about the package on Fedora System.

Alternatively, it can be achieved by running the RPM Package Manager command on RHEL/CentOS/Fedora Systems. If no results found, it means the given package is not available.

For Debian based systems, run the APT Package Manager command or APT-GET Package Manager command to get the information about the package.

Using apt-cache command.

For Arch Linux based systems, run the Pacman Package Manager command or any of AUR helper to get the information about the package.

Run the Zypper Package Manager command to get the information about the package on openSUSE System.

It seems the sar package is not available in any of the major distributions as per the above output. So, what will be the next action on this to get it.

Читайте также:  Gacha life для windows

Step-2:

Run the following commands to check the sar command absolute path. Make a note, you may get the following output which: no sar in if the parent package is not installed on the system.

If the parent package is not installed on your system and you will be getting the output similar to below or bit different, it’s based on your distro.

Step-3:

Identify the parent package name using the following commands based on your distribution.

Run the following command to identify the parent package name for the sar on RHEL/CentOS/Fedora/openSUSE systems.

This result we got it from the above step-2 by using the which sar .

Alternatively, we can achieve this by running following command on RHEL/CentOS systems.

One more alternative for this.

Other alternative for this.

Run the following command to check what other sub package is available in this parent package.

Run the following commands to identify the parent package name for the ip using dpkg Package Manager command on Debian/Ubuntu/LinuxMint systems.

Using dpg-query command to get the information.

Run the following command to check what other sub package is available in this parent package.

As an alternate, we can get this using apt-file command. Make sure your system should have installed apt-file command. If it’s not already installed and you can use the following command to install it.

Update the database cache using following command.

Run the following commands to identify the parent package name for the ip using apt-file command on Debian/Ubuntu/LinuxMint systems.

Alternatively, we can run the following command to check what other sub package is available in this parent package.

Run the following command to identify the parent package name for the ps on Arch Linux/Manjaro systems. Make sure your system should have installed pkgfile command. If it’s not already installed and you can use the following command to install it.

Update the database cache using following command.

Run the following commands to identify the parent package name for the ps using apt-file command on Arch Linux/Manjaro systems.

Run the following command to check what other sub package is available in this parent package.

Run the following command to identify the parent package name for the ls on openSUSE system.

If the parent pacakge is not installed on your system then you won’t be able to identify the parent package name eventhough if you know the sub package name.

In this sceniro, I would suggest you to use any of the one following command to identify the parent package name.

From Debin website.

From Ubuntu website: Navigate to https://packages.ubuntu.com/ website and search whatever you want.

From Fedora website: Navigate to https://packages.ubuntu.com/ website and search whatever you want.

Источник

How To Find The Package That Provides A File (Installed Or Not) On Ubuntu, Debian Or Linux Mint

There are multiple ways of finding out to which package a particular file belongs to, on Ubuntu, Debian or Linux Mint. This article presents two ways of achieving this, both from the command line.

From the same series:

1. Using apt-file to find the package that provides a file (for repository packages, either installed or not installed)

apt-file indexes the contents of all packages available in your repositories, and allows you to search for files in all these packages.

That means you can use apt-file to search for files inside DEB packages that are installed on your system, as well as packages that are not installed on your Debian (and Debian-based Linux distributions, like Ubuntu) machine, but are available to install from the repositories. This is useful in case you want to find what package contains a file that you need to compile some program, etc.

Читайте также:  Драйвер для клавиатуры windows 10 64 bit

apt-file cannot find the package that provides a file in case you downloaded a DEB package and installed it, without using a repository. The package needs to be available in the repositories for apt-file to be able to find it.

apt-file may not be installed on your system. To install it in Debian, Ubuntu, Linux Mint and other Debian-based or Ubuntu-based Linux distributions, use this command:

This tool find the files belonging to a package by using a database, which needs to be updated in order to be able to use it. To update the apt-file database, use:

Now you can use apt-file to find the DEB package that provides a file, be it a package you’ve installed from the repositories, or a package available in the repositories, but not installed on your Debian / Ubuntu / Linux Mint system. To do this, run:

Replacing filename with the name of the file you want to find.

This command will list all occurrences of filename found in various packages. If you know the exact file path and filename, you can get the search results to only list the package that includes that exact file, like this:

For example, running only apt-file search cairo.h will list a large list search results:

However, if you know the file path, e.g. you want to find out to which package the file /usr/include/cairo/cairo.h belongs to, run:

This only lists the package that contains this file:

In this example, the package that includes the file I searched for ( /usr/include/cairo/cairo.h ) is libcairo2-dev .

apt-file may also be used to list all the files included in a package ( apt-file list packagename ), perform regex search, and more. Consult its man page ( man apt-file ) and help for more information ( apt-file —help ).

2. Using dpkg to find the package that provides a file (only for installed DEB packages — from any source)

dpkg can also be used to find out to which package a file belongs to. It can be faster to use than apt-file, because you don’t need to install anything, and there’s no database to update.

However, dpkg can only search for files belonging to installed packages, so if you’re searching for a file in a package that’s not installed on your system, use apt-file. On the other hand, dpkg can be used to find files belonging to packages that were installed without using a repository, a feature that’s not available for apt-file.

To use dpkg to find the installed DEB package that provides a file, run it with the -S (or —search ) flag, followed by the filename (or pattern) you want to see to which package it belongs, like this:

For example, to find out to which package the cairo.h file belongs to, use dpkg -S cairo.h :

Just like for apt-file, this may show multiple packages that have files containing the filename you’re looking for. You can enter the full path of the file to get only the package that contains that specific file. Example:

In this example, the Debian package that includes the file I searched for ( /usr/include/cairo/cairo.h ) is libcairo2-dev .

Other notable ways of finding the package a file belongs to is using the online search provided by Ubuntu and Debian:

  • Ubuntu: https://packages.ubuntu.com/ — scroll down to Search the contents o packages and enter the filename you’re looking for, as well as the distribution (Ubuntu version) and architecture.
  • Debian: https://www.debian.org/distrib/packages#search_contents — the search is similar to the one available for Ubuntu, so enter the filename you want to find, the distribution and architecture.
Читайте также:  Activator windows 10 permanent activator ultimate

For both, you’ll also find options to find the packages that contain files named exactly like your input keyword, packages ending with the keyword, or packages that contains files whose names contain the keyword.

The Linux Mint package search website doesn’t include an option to search for files inside packages, but you can use the Ubuntu or Debian online package search for packages that Linux Mint imports from Debian / Ubuntu.

Источник

How To Find The Package That Provides A Specific File In Linux

This brief tutorial explains a few different ways to find the package that provides a specific file in Linux. This could be useful when you manually compile and install a package. When you’re compiling a package from source, there are chances that you may receive an error something like «No rule to make target ‘ ‘, needed by ‘ ‘. Stop.». You may not know exactly which packages provides the missing file. In such cases, you can easily find out the packages that provides those missing files and install them in your Linux box as described in this guide.

Find The Package That Provides A Specific File In Linux

Arch Linux, Antergos, Manjaro Linux:

On Arch-based, there is a small command line tool called pkgfile, which is used to search files from packages.

Pkgfile comes pre-installed with Arch Linux. If it’s not, you can install using the following command:

Then, run the following command to sync with pkgfile database:

Now, you can find the package that provides a specific file, say for example alisp.h, using command:

As you see in the above output, alsa-lib package provides alisp.h file. And, the package is available from extra repository. You can now install this package as shown below.

To list all files provided by the alsa-lib package, run:

RHEL, CentOS, Fedora:

In YUM-based systems such as RHEL and its clones like CentOS, Scientific Linux, you can find the package that owning a particular file, using the following command:

On Fedora, use the following command instead:

If the file is already available in your system, say for example /bin/ls, you can then find the package that owns the file using command:

You can also use the repoquery command as follows:

If repoquery command is not available in your system, install yum-utils package.

Debian, Ubuntu, Linux Mint:

In any DEB-based systems, you can find the package that provides a certain file using apt-file tool.

Install apt-file as shown below if it’s not installed already:

If you just installed apt-file, the system-wide cache might be empty. You need to run ‘apt-file update’ as root to update the cache. You can also run ‘apt-file update’ as normal user to use a cache in the user’s home directory.

Let us update the database cache using command:

And, then search for the packages that contains a specific file, say alisp.h, with command:

Sample would be:

Well, libasound2-dev it is! You can install this package using command:

If you already have the file, and just wanted to know which package it belongs to, you can use dpkg command as shown below.

If you know the full path of the file, say for example /bin/ls, you can search for the packages it belongs to using the following command:

SUSE / openSUSE:

On SUSE and openSUSE, run the following command to find out which package a certain file belongs to.

Suggested read:

And, that’s all. Hope this helps. If you know any other methods to find to find the package that contains a particular file, feel free to let us know in the comment section below. I will check and update the guide accordingly.

Источник

Оцените статью