The following command will flush the dns entries for Ubuntu 18.04 LTS.

sudo systemd-resolve --flush-caches

This will also work for any Linux distro using the “systemd” Network Name Resolution manager.