Getting [iMac.domain_not_set.invalid ~] in Terminal
Your hostname is not set correctly. This could be because of the information you set in Sharing in System Preferences, or because the DHCP server gave your system an incorrect hostname to use.

To fix this, change your hostname in Sharing, or in case of a DHCP issue, check the DHCP server configuration.