 |
 |
Meaning of Terminal prompts?
|
 |
|
 |
|
Professional Poster
Join Date: Jul 2001
Location: New York, NY
Status:
Offline
|
|
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
|
|
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
|
|
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.
|
|
|
| |
|
|
|
 |
|
 |
|
Grizzled Veteran
Join Date: Jun 2001
Location: Seattle
Status:
Offline
|
|
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]
|
|
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: Dec 2001
Location: England, UK
Status:
Offline
|
|
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"
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|