• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Terminal prompt question

 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On my PowerBook, Terminal gives me a prompt like...

computerName:~ userName$

But on my iMac, Terminal gives me a prompt like...

user-xxlxxkx:~ userName$

...where the x's are digits. Does anyone know why it shows "user-xxlxxkx" instead of the computer name? Both machines are running bash, OS 10.4.6.

My reference book, The Mac OS X Command Line - Unix Under the Hood, just says that this part should be the computer name as shown on the Sharing panel under System Preferences. But my iMac's name is simply "imac-g5".
[ May 10, 2006: Message edited by: marc weber ]
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Update: I've noticed that this only happens when my iMac is connected to the internet. When it's not connected, the correct name shows in the prompt.

It was suggested on the Apple boards that when I'm connected to my ISP's network, this might be the node name on that network rather than my computer's "given" name.

Does this make sense? I'm not network savvy, and I just want to make sure that something isn't misconfigured. (I connect differently with my PowerBook, so it makes sense that I would only see this on my iMac.)
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, it makes sense if these two things are different.

The prompt is controlled by an idiosyncratic little code in the environment variable "PS1". The first component by default is "\h", which represents the host name. To learn how to customize the prompt, say "info bash", and then in the info program "/PS1" to find a link to the "Printing a Prompt" page, which explains all the codes.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic