host name

ericmurphy

Registered
Is there a quick way to change the name of the host as it appears in the terminal window, without screwing anything up on the system that depends on that name? I'd like the name to be the same as the computer's name in the Sharing preference panel. As I recall, you could edit this by editing

/etc/hostconfig, and changing HOSTNAME=-AUTOMATIC- to
HOSTNAME=-WHATEVERYOUWANTTOCALLIT-

Is this true, or safe? Any reason not to do it? Or is there somewhere else it can be done from, such as a system control panel?
 
yes, it is true, and it is safe, and i can think of no reason not to do it. in fact, i think it kind of sukcs to have localhost as your hostname. so automatic is only useful if your DHCP server hands out hostnames, or hands out IP addresses that can be resolved to hostnames.

so go ahead, and do it. also you will see in /etc/hostconfig an entry for the appletalk name, which corresponds to the sharing name you see in system preferences. AFAIK there is no other way than this to do the real hostname though
 
I edited /etc/hostconfig with the hostname I wanted. Do I need a restart for the changes to take effect? I didn't see any difference in the hostname at the command line...
 
My terminal prompt is my IP address, except the first set of numbers has been replaced by <<msp>>, which is to say, TimeWarner uses 24 in the first string to represent Minneapolis, Minnesota, but, ostensibly for security purposes, chooses to script the prompt to say <<msp>> instead. DID they script the same thing that testuser described above?
 
Very cool, testuser. Since I am not quite so familiar with shell scripts, could you explain what the %c3 and %n% do?
 
Thanks, testuser! There are many good things about AOL/TimeWarner's RoadRunner cable modem service (incidentally, I do NOT subscribe to AOL), and this is one of them. What could be more convenient than having your IP address displayed on every prompt line of every terminal session running on (even remotely!) your OS X box?
 
Hmm. I simply changed the environment variable that gets spewed into the prompt:

setenv HOST Aliens

Or something like that in the .cshrc file in my home directory...
 
Back
Top