Scroll to navigation

DNF5-REMOVE(8) dnf5 DNF5-REMOVE(8)

NAME

dnf5-remove - Remove Command

SYNOPSIS

dnf5 remove [options] <package-spec-NF>|@<group-spec>|@<environment-spec>...

dnf5 remove --oldinstallonly [--limit=<LIMIT>] [<package-spec-NF>...]

dnf5 remove --duplicates [<package-spec-NF>...]

DESCRIPTION

The remove command in DNF5 is used for removing installed packages, groups or environments from the system.

If you want to keep the dependencies that were installed together with the given package, set the clean_requirements_on_remove configuration option to False.

When the --oldinstallonly option is used, the command removes old installonly packages (e.g. kernels) that exceed the configured installonly_limit. The currently running kernel is never removed. If package specs are provided, only matching installonly packages are considered for removal.

When the --duplicates option is used, the command removes older versions of duplicate packages. Duplicate packages are packages with the same name and architecture but different version installed on the system. Installonly packages (such as kernels) are excluded since they are expected to have multiple versions installed. To ensure the integrity of the system, the newest version of each duplicate is reinstalled. If package specs are provided, only matching packages are considered.

OPTIONS

Filters installed packages by the ID of the repository they were installed from.


Disable removal of dependencies that are no longer used.

Remove old installonly packages that exceed the installonly_limit configuration value.
When used without package specs, all installonly package types are considered.
The currently running kernel is automatically skipped.

Override the installonly_limit configuration value. Must be greater than or equal to 1
to keep at least the newest installed version. Can only be used with --oldinstallonly.

Remove older versions of duplicate packages and reinstall the newest version.
Installonly packages are automatically excluded.
Cannot be used together with --oldinstallonly.


Store the transaction to be performed offline. See offline command <#offline-command-ref-label>, dnf5-offline(8).


Applicable only on bootc (bootable containers) systems. Perform transactions using a transient overlay which will be lost on the next reboot. See also the persistence <#persistence-options-label> configuration option.
Store the current transaction in a directory at the specified PATH instead of running it.
The stored transaction can be performed by the replay command <#replay-command-ref-label>, dnf5-replay(8).
Note that repository ids in the stored transaction are mangled to @stored_transaction(repo_id) this is required
because during replaying the stored repositories are recreated and they might collide with already present repositories
(this doesn't apply to the special @System repository).


EXAMPLES

Remove the tito package.

Remove all old installonly packages exceeding the configured installonly_limit.

Remove old kernel packages exceeding the configured installonly_limit.

Remove old installonly packages, keeping only the 2 newest versions of each.

Remove all older duplicate packages and reinstall the newest versions.

Remove older duplicate versions of glibc and reinstall the newest.


SEE ALSO

dnf5-specs(7), Patterns specification <#specs-misc-ref-label>



Author

See AUTHORS.md in dnf5 source distribution.

Copyright

Contributors to the dnf5 project.

August 23, 2026