Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Mac OS X > Meaning of Terminal prompts?

Meaning of Terminal prompts?
Thread Tools
Professional Poster
Join Date: Jul 2001
Location: New York, NY
Status: Offline
Reply With Quote
Feb 25, 2003, 06:16 PM
 
Hey everybody:

So I open Terminal and normally the prompt looks like this:

[Telemachos:~] cpac%

Telemachos is the name of my computer, and cpac is my user name.

Now, frequently after being on a windows network for a while, I get a different prompt when opening the terminal. Currently, for instance, it looks like this:

[hernandezj:~] cpac%

So what's the deal? What does that initial word indicate? Do I need to hunt down J. Hernandez and kill him?
cpac
     
Mac Elite
Join Date: Dec 2001
Location: Atlanta, GA, USA
Status: Offline
Reply With Quote
Feb 25, 2003, 11:07 PM
 
You can set your prompt to whatever you like. The default for tcsh is:

PS1=[\u@\h \w]

\u is the user, \h is the host, \w is the working directory.

I use bash, and I have my prompt set as follows:

export PS1="[\u@\h \w] "

which is essentially the same thing. You can do some funky prompts though. For example:

export PS1="\[\e[1;37m\][\[\e[1;33m\]\u@\h \e[1;32m\]\w\[\e[1;37m\]]\[\e[0;37m\] "

That will give you all kinds of nifty colors.

Look at the man pages for your shell and grep for "PS".
Mac Pro 2x 2.66 GHz Dual core, Apple TV 160GB, two Windows XP PCs
     
Mac Elite
Join Date: Feb 2001
Location: Vancouver, WA
Status: Offline
Reply With Quote
Feb 26, 2003, 02:00 AM
 
As for the changing hostname, the default config on OS X sets it based on your IP address. Except the BSD notion of hostname (in which there can be only one) predates the modern era of multilink/multihoming mobile networking (in which you might have several addresses or only the Rendezvous-provided one). So, the BSD hostname is liable to change when you reboot on different networks (or without an external network).

If you find this annoying, you can manually set a hostname by editing /etc/hostconfig: change the line that says HOSTNAME=-AUTOMATIC- to HOSTNAME=whatever.
Rick Roe
icons.cx | weblog
     
Grizzled Veteran
Join Date: Jun 2001
Location: Seattle
Status: Offline
Reply With Quote
Feb 26, 2003, 07:31 AM
 
Originally posted by Rickster:
As for the changing hostname, the default config on OS X sets it based on your IP address. Except the BSD notion of hostname (in which there can be only one) predates the modern era of multilink/multihoming mobile networking (in which you might have several addresses or only the Rendezvous-provided one). So, the BSD hostname is liable to change when you reboot on different networks (or without an external network).

If you find this annoying, you can manually set a hostname by editing /etc/hostconfig: change the line that says HOSTNAME=-AUTOMATIC- to HOSTNAME=whatever.
I followed these instructions exactly and now my terminal looks like this:

[whatever:~] bs%

Why is my mac so apathetic now and accusatory now?

~BS

[edit: sorry, it's late. back to cramming]
     
Lew
Senior User
Join Date: Dec 2001
Location: England, UK
Status: Offline
Reply With Quote
Feb 26, 2003, 07:41 AM
 
Originally posted by MrBS:
Originally posted by Rickster:
As for the changing hostname, the default config on OS X sets it based on your IP address. Except the BSD notion of hostname (in which there can be only one) predates the modern era of multilink/multihoming mobile networking (in which you might have several addresses or only the Rendezvous-provided one). So, the BSD hostname is liable to change when you reboot on different networks (or without an external network).

If you find this annoying, you can manually set a hostname by editing /etc/hostconfig: change the line that says HOSTNAME=-AUTOMATIC- to HOSTNAME=whatever
I followed these instructions exactly and now my terminal looks like this:

[whatever:~] bs%

Why is my mac so apathetic now and accusatory now?

~BS

[edit: sorry, it's late. back to cramming]
You need to press the 'Any' key

Just kidding. It says that because you edited the line to say "HOSTNAME=whatever". You need to substitute the name you want your computer to show up as for 'whatever'. For example, my hostconfig file says "HOSTNAME=Pismo"
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 05:41 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2