Flushing dns caching in linux

Problem

You want to update your dns resolution locally after some change in DNS.

You want to do this because your local dns cache still holds the old information about the domain. For example using your local dns and the google one returns two different results

BASH

Solution

Check your systemd-resolved is active:

BASH

Get some statistics:

BASH

Flush the cache (make the Current Cache Size above 0)

BASH

Check the cache again (should be 0 now):

BASH

Information taken from https://www.techrepublic.com/article/how-to-flush-the-dns-cache-on-linux/