resolvectl

resolvectl shows the information related to name resolution coming from the resolve daemon

Installation

When resolvectl is not installed by default, it can be added to the system using the relevant software package.

Package information for resolvectl

Operating systemPackage nameInstallation
AlmaLinuxsystemd-resolved
dnf install systemd-resolved
Arch Linuxsystemd
pacman -S systemd
Debiansystemd
apt install systemd
Fedorasystemd-resolved
dnf install systemd-resolved
Red Hat Enterprise Linuxsystemd-resolved
dnf install systemd-resolved
Rocky Linuxsystemd-resolved
dnf install systemd-resolved
Ubuntusystemd
apt install systemd

Your Linux distribution using a different package? Share your feedback.

Usage

Available options

Short optionLong optionDescription
-i IFACE--interface=IFACEDefine interface to be used together with a DNS query
-t TYPE--type=TYPEDefine DNS record type, to be used with query command

Missing an option in this overview? Share your feedback.

Subcommands

CommandDescriptionExtra information
flush-cachesClear DNS cache
reset-statisticsReset the counter of the resolver statisticsRoot privileges required
statisticsShow resolver statistics
status [LINK]Show DNS settings (global or link)LINK equals the interface

Missing a command? Share your feedback.

Examples using resolvectl

Resolve domain name or IP address

Perform a lookup of the linux-audit.com domain

resolvectl query linux-audit.com

Query specific DNS records

Usage of --type in combination with query

resolvectl query --type=ns linux-audit.com

Avoid caching when performing queries

Avoid the cache when querying a record

resolvectl query --type=a --cache=false linux-audit.com

Clear DNS cache

Flush the cache that stores DNS records. Useful for clearing out outdated results.

resolvectl flush-caches

Relevant articles using the resolvectl command

The following articles include an example on how to use resolvectl and might be worth further exploring.