Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question
    

1 Answer 1

up vote 6 down vote accepted

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

share|improve this answer
    
#2 is where the default value of #4 is stored, not a separate thing. #3 is used before #2/#4, which is what ConfusedNoob is seeing. –  Kevin Reid Oct 14 '11 at 21:02
    
true, Kevin — yes, if you want to get specific. but since there is no place in the GUI, unless you have Server app installed, to set the former, I had to list the file. –  username Oct 14 '11 at 21:07
    
hang on a sec ;) #3 is most certainly not used before #2 — that would defeat the whole purpose. this is because #2 is a replacement for hostconfig, and is meant to allow one to override any other values, like a changing reverse DNS name. there would be no point setting a static hostname if it were to simply be steamrolled as soon as you connect to a network... aw crap, this is more complicated than the original poster probably wanted :( –  username Oct 14 '11 at 21:10
    
at any rate the original poster would likely not have a value defined for System ▸ System ▸ HostName unless he has installed the Server OS — the name he's seeing is likely the Bonjour name, unless he's got a public IP or a private DNS server running on his local network –  username Oct 14 '11 at 21:20
    
I think it must be 3. It isn't anywhere else and seems to change randomly... –  ConfusedNoob Oct 14 '11 at 21:44

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.