- [Narrator] In this video, I wanna tell you how
the rpm command still can be useful.
In the past, rpm was used for package installation.
Nowadays, really, you shouldn't be doing that anymore
because it's not taking care of any dependencies.
However, rpm is still useful for queries.
You can query the rpm database,
and you can query individual packages.
For instance, you can use rpm -qf to find the package
where a file is coming from.
And that is useful if you know which file you need
to update, but you don't know the package
that belongs to the file.
And once you've found the package, you can use rpm -ql
on that package to query the rpm database,
to list the package contents.
It can also be useful to query the package file
instead of the package contents.
And if you wanna do that you add a p to the options.
Like rpm -qpc in a package. which will list
configuration files in the downloaded package file.
Or a very important one, rpm -qp --scripts
on a package.
That will show you installation scripts that are
in the package.
And as you know, the packages are installed
with root privileges.
You might want to check out the contents of the package
before actually running the root based insular.
Let me demonstrate.
So let me start with pseudo rpm -qf
on which ifconfig.
That's a nice one.
You remember, ifconfig the obsolete command?
ifconfig is coming from Net Tools.
So what else do we have in Net Tools?
Well, pseudo rpm,
- ql Net Tools.
If you query packages you don't have to install
the version information.
Just the package name is enough.
And now we can see that's kind of a lot
so I need to use a graph to filter it down a little bit.
Let me graph on bin so that we only can see the binaries.
So here are the other deprecated packages
from the Net Tools package.
So that's convenient because now we know
that we can use pseudo dnf or remove Net Tools.
I would always verify the contents of the package
before you are actually going to remove it.
And that's done.
We don't have IF conflict anymore. Right.
The package file queries.
Let me use ls on *rpm because I have a couple
of rpms and I wanna work with virtio win.
So rpm -qpc, the p is for package file, so this
allows you to query a package file.
The c is for configuration and oh we can see
there's no configuration files in there.
Well, you know what. Let's do, let's do a qpl
and there we can see everything in this package.
And that allows you to verify the contents of a package.
Now packages typically are installed,
and very often there's an installation script.
And if you want to see what is
in that script use --scripts. Nothing in there?
Okay, let's see if there's an installation script
in another one.
Maybe we should use pseudo URL downloader.
URL downloader is what you can use to
download individual packages.
And I want to download a package that contains
a service like vsftpd.
Services normally do have an installation script.
So let's check if that is really the case.
rpm -qp --scripts on vsftpd.
And there we go.
Here you can see the scripts that are provided.
So there's a post-install and a pre-uninstall.
And is there anything else, a post un-install?
The thing here is that if we have a post-install
that's all very nice
but this script will be executed with root privileges.
So you really wanna make sure that there is nothing
happening in the script that you don't like.
And that is how rpm queries come in handy
every now and then.