Where does the prompt name come from in the macOS Terminal?
Where does the word at the beggining of the prompt on my MacBook Pro terminal come from?
At the moment, it looks like this
Last login: Fri Oct 14 12:55:34 on ttys000
sherrythinkpad:~ ConfusedNoob$
sherrythinkpad:~ ConfusedNoob$
Obviously, the ConfusedNoob is my username - but where on Earth is sherrythinkpad
coming from?
Terminal is showing you the first label of your BSD hostname (assuming your shell is BASH). If your BSD hostname is yourhostname.mynetwork.com
then Terminal will display only yourhostname
-
So from where does the BSD hostname come? It can come from several places:
From the file:
/etc/hostconfig
Else from the file:
/Library/Preferences/SystemConfiguration/preferences.plist
(System ▸ System ▸ HostName)Else the result of a reverse DNS query for your primary IP address (so you might notice a totally different hostname showing up when you visit an internet café than when connected at home)
Else your "Bonjour" hostname in System Preferences > Sharing (
preferences.plist
again... System ▸ Network ▸ HostNames ▸ LocalHostName)Finally, if none of the above have been set, the BSD hostname will be simply
localhost