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. I got this request from one of our regular reader.

He was requesting us to write an article about this topic. Yes, we got a time today to write up about this title.

Don’t 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 what to do to find the parent package name? Yes, it’s not a big deal, i’m hear to help you out on this.

You may feel to ask this title in many ways, it’s different from each person like how they are seeing.

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.

# yum info sar
Error: No matching Packages to list

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

# dnf info sar
Error: No matching Packages to list

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.

# rpm -qa sar

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

$ apt -q list sar
Listing...

Using apt-cache command.

$ apt-cache policy sar
sar:
  Installed: (none)
  Candidate: (none)
  Version table:

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

$ pacman -Ss '^sar^'

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

# zypper info sar
Loading repository data...
Reading installed packages...
package 'sar' not found.

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.

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.

# which sar
/usr/bin/sar
 
# whereis sar
sar: /usr/bin/sar /usr/share/man/man1/sar.1.gz
 
# type sar
sar is /usr/bin/sar

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.

# which sar
which: no sar in (/usr/ht/cmds13:/usr/ht/bin13:/usr/ht/lib13:/usr/ht/etc:/usr/obj/cmds:/bin:/usr/bin:/opt/.ht/usr/bin:/etc:/usr/lib:/usr/hitch/bin:.:/root/bin:/sbin:/usr/sbin)

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.

# rpm -qf /usr/bin/sar
sysstat-10.1.5-12.el7.x86_64

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

# yum provides sar
Loaded plugins: changelog, enabled_repos_upload, package_upload, product-id, search-disabled-repos, subscription-manager, verify,
              : versionlock
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
sysstat-10.1.5-4.el7.x86_64 : Collection of performance monitoring tools for Linux
Repo        : rhel-7-server-rpms
Matched from:
Filename    : /usr/bin/sar
 
sysstat-10.1.5-7.el7.x86_64 : Collection of performance monitoring tools for Linux
Repo        : rhel-7-server-rpms
Matched from:
Filename    : /usr/bin/sar

One more alternative for this.

# yum whatprovides sar
Loaded plugins: changelog, enabled_repos_upload, package_upload, product-id, search-disabled-repos, subscription-manager, verify,
              : versionlock
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
sysstat-10.1.5-4.el7.x86_64 : Collection of performance monitoring tools for Linux
Repo        : rhel-7-server-rpms
Matched from:
Filename    : /usr/bin/sar
 
sysstat-10.1.5-7.el7.x86_64 : Collection of performance monitoring tools for Linux
Repo        : rhel-7-server-rpms
Matched from:
Filename    : /usr/bin/sar

Other alternative for this.

# repoquery -f /bin/ls
coreutils-0:8.22-15.el7.x86_64
coreutils-0:8.22-12.el7_1.2.x86_64
coreutils-0:8.22-11.el7.x86_64
coreutils-0:8.22-18.el7.x86_64
coreutils-0:8.22-15.el7_2.1.x86_64

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

# rpm -ql sysstat-10.1.5-12.el7.x86_64 | grep -i "/bin/*\|/sbin/*\|/usr/bin/*\|/usr/sbin/*"
/usr/bin/cifsiostat
/usr/bin/iostat
/usr/bin/mpstat
/usr/bin/nfsiostat-sysstat
/usr/bin/pidstat
/usr/bin/sadf
/usr/bin/sar
/usr/bin/tapestat

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

$ dpkg -S /bin/ip
iproute2: /bin/ip

Using dpg-query command to get the information.

$ dpkg-query --search '/bin/ip'
iproute2: /bin/ip

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

$ dpkg-query -L iproute2 | grep "/bin/*'\|/sbin/*\|/usr/bin/*\|user/sbin/*"
/sbin
/sbin/bridge
/sbin/devlink
/sbin/rtacct
/sbin/rtmon
/sbin/tc
/sbin/tipc
/usr/bin
/usr/bin/lnstat
/usr/bin/nstat
/usr/bin/rdma
/usr/bin/routef
/usr/bin/routel
/usr/sbin
/usr/sbin/arpd
/usr/sbin/genl
/sbin/ip
/usr/bin/ctstat
/usr/bin/rtstat

Alternatively, 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.

$ sudo apt install apt-file

Update the database cache using following command.

$ sudo apt-file update

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

$ apt-file search '/bin/ip' | egrep -wi "/bin/ip"
iproute2: /bin/ip

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

$ apt-file list sysstat | grep "/bin/*'\|/sbin/*\|/usr/bin/*\|/usr/sbin/*"
sysstat: /usr/bin/cifsiostat
sysstat: /usr/bin/iostat
sysstat: /usr/bin/mpstat
sysstat: /usr/bin/pidstat
sysstat: /usr/bin/sadf
sysstat: /usr/bin/sar.sysstat
sysstat: /usr/bin/tapestat

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.

$ sudo pacman -S pkgfile

Update the database cache using following command.

 
$ sudo pkgfile -u

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

$ pkgfile ps
core/procps-ng
extra/docbook-utils
extra/xmlto
community/plan9port

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

$ pkgfile -l procps-ng | grep -i "/bin/*\|/sbin/*\|/usr/bin/*\|/usr/sbin/*"
core/procps-ng	/usr/bin/
core/procps-ng	/usr/bin/free
core/procps-ng	/usr/bin/pgrep
core/procps-ng	/usr/bin/pidof
core/procps-ng	/usr/bin/pkill
core/procps-ng	/usr/bin/pmap
core/procps-ng	/usr/bin/ps
core/procps-ng	/usr/bin/pwdx
core/procps-ng	/usr/bin/slabtop
core/procps-ng	/usr/bin/sysctl
core/procps-ng	/usr/bin/tload
core/procps-ng	/usr/bin/top
core/procps-ng	/usr/bin/uptime
core/procps-ng	/usr/bin/vmstat
core/procps-ng	/usr/bin/w
core/procps-ng	/usr/bin/watch

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

$ zypper se --provides --match-exact /bin/ls
Loading repository data...
Warning: Repository 'Update Repository (Non-Oss)' appears to be outdated. Consider using a different mirror or server.
Warning: Repository 'Main Update Repository' appears to be outdated. Consider using a different mirror or server.
Reading installed packages...

S | Name      | Summary            | Type  
--+-----------+--------------------+--------
i | coreutils | GNU Core Utilities | package

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.

$ links https://packages.debian.org/file:/usr/bin/ps

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.

Prakash Subramanian

Prakash Subramanian is a Linux lover and has 3.5+ years of experience in linux server administration with major Linux distribution such as (RHEL, CentOS, Ubuntu). He is currently working as a Senior L2 Linux Server administrator.

You may also like...

Shares
Close
Please support the site
By clicking any of these buttons you help our site to get better