• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Terminal prompt question

 
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.)
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
I'm all tasted up for a BLT! This tiny ad wants a monte cristo!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic