Forrest logo
back to the resolvectl tool

resolvectl:tldr:0e874

resolvectl: Retrieve an MX record of a domain.
$ resolvectl --legend=${no} --type=${MX} query ${domain}
try on your machine

The command "resolvectl --legend=${no} --type=${MX} query ${domain}" is used to query the DNS (Domain Name System) resolver for the MX (Mail Exchange) records of a specific domain.

Let's break down the command:

  • "resolvectl" is the utility used for managing and querying system DNS settings.
  • "--legend=${no}" is an option used to disable the legend, which provides a header line explaining the output. In this case, it is set to "no" (or any specific value), indicating that the legend should be turned off.
  • "--type=${MX}" is an option that specifies the type of DNS record being queried. In this case, it is set to "MX" to retrieve Mail Exchange records.
  • "query" is the command used to initiate a DNS query.
  • "${domain}" is a placeholder for the domain name you want to query. You need to replace it with the actual domain name you wish to retrieve MX records for.

By executing this command, the resolver will search for the MX records for the specified domain and provide the results.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the resolvectl tool