Читать книгу Mastering Linux System Administration - Richard Blum - Страница 96

Listing Installed Packages

Оглавление

To find out what is currently installed on your system, at the shell prompt use the list option of the dnf command, as shown here:

$ dnf list installed Installed Packages NetworkManager.x86_64 1:1.22.8-5.el8_2 @BaseOS NetworkManager-config-server.noarch 1:1.22.8-5.el8_2 @BaseOS NetworkManager-libnm.x86_64 1:1.22.8-5.el8_2 @BaseOS NetworkManager-team.x86_64 1:1.22.8-5.el8_2 @BaseOS NetworkManager-tui.x86_64 1:1.22.8-5.el8_2 @BaseOS PackageKit.x86_64 1.1.12-4.el8 @AppStream PackageKit-glib.x86_64 1.1.12-4.el8 @AppStream abattis-cantarell-fonts.noarch 0.0.25-4.el8 @AppStream acl.x86_64 2.2.53-1.el8 @BaseOS adcli.x86_64 0.8.2-5.el8 @BaseOS at.x86_64 3.1.20-11.el8 @BaseOS attr.x86_64 2.4.48-3.el8 @BaseOS audit.x86_64 3.0-0.17.20191104git1c2f876.el8 @BaseOS audit-libs.x86_64 3.0-0.17.20191104git1c2f876.el8 @BaseOS … $

There will be lots of packages installed on your server; it usually helps to redirect the output to the more or less command to look at the list in a controlled manner. You can also redirect the output to a text file for viewing in a text editor.

dnf list installed > installed.txt

The format of the listing is a little different from the format of the original package names, but you can probably pick out the different components. The package name and architecture are listed first, followed by the version and release. The third column shows what repository category the package came from.

You can also look for a single installed package.

$ dnf list installed bash Installed Packages bash.x86_64 4.4.19-10el8 @BaseOS $

If the package isn't installed, dnf will tell you.

$ dnf list installed zsh Error: No matching Packages to list $

You can then check if the package is available in the software repository by using the list option with the software package name.

$ dnf list zsh Last metadata expiration check: 0:00:18 ago on Sat 05 Dec 2020 10:33:03 AM EST. Available Packages zsh.x86_64 5.5.1-6.el8_1.2 BaseOS $

Finally, if you need to find out what software package provides a particular file on your filesystem, use the provides option.

dnf provides file_name

Here's an example of trying to find what software provided the file /usr/bin/gzip :

$ dnf provides /usr/bin/gzip Last metadata expiration check: 0:04:02 ago on Sat 05 Dec 2020 10:32:22 AM EST. gzip-1.9-9.el8.x86_64 : The GNU data compression program Repo : @System Matched from: Filename : /usr/bin/gzip gzip-1.9-9.el8.x86_64 : The GNU data compression program Repo : BaseOS Matched from: Filename : /usr/bin/gzip $

dnf checked two separate repositories: the local system (denoted by @System) and the default fedora repository (denoted by BaseOS). That allows you to easily check whether there's an update available for the file.

Mastering Linux System Administration

Подняться наверх