wood burning stoves*
The moose likes Mac OS and the fly likes Terminal prompt question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » Mac OS
Bookmark "Terminal prompt question" Watch "Terminal prompt question" New topic
Author

Terminal prompt question

marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

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 ]

"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

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

Joined: Jul 08, 2003
Posts: 24183
    
  34

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.


[Jess in Action][AskingGoodQuestions]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Terminal prompt question
 
Similar Threads
JAVA on MAC OS 10.4
is the free solaris8 really $75?
why don't i get the command prompt back when I run my java program from the terminal window?
Getting started with Java on MacOS
Intel iMac and new laptop line announced at MacWorld