Hello everyone,
In this article, we will look at which package the commands we use can be used with. “Which package do we need to be able to use this command?” This article will be a kind of answer to these questions.

While searching the internet for a problem we encountered, we notice that some of the commands offered as a solution do not work on our system. You may need some packages to be able to run the aforementioned commands. Let's take a look at how we can find these packages together.

Finding the File Path of the Invoked Command

First of all, we should mention that the commands used are actually files. We will first find these files to which the commands are attached. For this which We will use the command. Use of "which command”. As an example, showing the instant processes of the system top Let's take the command. Let's say we don't know which package this command belongs to. to the command line

which top

Let's write. This will show us the path to the file from which the command is run.

#Komut satırı çıktısı

This file may not be our direct package. In the next step we will see how to find the packages that contain this file.

Detection of the Package Containing the Script

We just learned the file of the command, now we will find out which package this file belongs to. For Pardus, we have two options at this step: One dpkg -S command is the other apt-file search.
If you ask what is the difference, apt-file search searches for the relevant expression in Pardus repositories. dpkg -S searches for packages installed on our system.

Terminal output of which, dpkg -S and apt-file search commands

As it turns out, dpkg -S showed us the installed packages containing the phrase we were searching for.
apt-file search, on the other hand, scanned the repositories and produced a wider range of results.

If we examine the image in more detail, aligned left in the part the answer we are looking for one package name is located, opposite it is the file path of the command whose package we are curious about.

If we talk for our example, as can be seen from the image top command procps It was a term included in the package.

What have we done now? First of all, we found the file of the command with which, and then we found out which package this file is in by using dpkg -S or apt-file search. Now we're going to automate this a little bit more.

As a Practical Use

Now we will see a more automated usage:

apt-file search $(which "top")


dpkg -S $(which "top")

We can replace the top expression here with other commands and find out which package they are in.

For example, in this example, the lspci command comes with the pciutils package.
If you encounter more than one result, find the line where the command name and the name in the file path are the same.

Now we can find the packages of the commands we are having trouble with and run them.

Take care of yourselves.