|
|
#1 |
|
Prospect
Join Date: Jan 2009
Location: South Africa
Posts: 42
|
Hello there,
Please could someone tell me how to alter "Michelle-Paces-MacBook-Pro" appearing immediately on the prompt line when opening my terminal window as shown below. The username of my account is "m". That part is fine, nice and short. Michelle-Paces-MacBook-Pro:~ m$ Thank-you in advance, Michelle Last edited by michellepace; 03-23-2011 at 08:08 PM. |
|
|
|
|
|
#2 |
|
Site Admin
Join Date: Jan 2002
Location: Montreal
Posts: 31,956
|
Try changing the computer name in the Sharing preferences.
__________________
hayne.net/macosx.html |
|
|
|
|
|
#3 | |||||||||||||||||||||||
|
Prospect
Join Date: Jan 2009
Location: South Africa
Posts: 42
|
Thanks Hayne, but I have already tried that but to know avail. I am sure there must be some type of unix'y command... or config setting somewhere ...? |
|||||||||||||||||||||||
|
|
|
|
|
#4 |
|
Site Admin
Join Date: Jan 2002
Location: Montreal
Posts: 31,956
|
1) What is the name of your computer in the Sharing preferences?
2) If your computer is attached to a network, then the "hostname" (which is what appears in the prompt) is often assigned by the DHCP server. Perhaps your router is assigning this name since that was the old name for this computer? You might need to reboot or reset your router.
__________________
hayne.net/macosx.html |
|
|
|
|
|
#5 |
|
Prospect
Join Date: Jan 2009
Location: South Africa
Posts: 42
|
oh I'm an idiot.
thanks Hayne.
|
|
|
|
|
|
#6 |
|
Site Admin
Join Date: Jan 2002
Location: Montreal
Posts: 31,956
|
It might help some future reader (via Google) if you explained what you were doing wrong. I.e. what was causing the problem.
By the way, since you seem to be concerned with the length of your prompt, you might want to customize your prompt via the facilities offered by your shell. E.g. for Bash (the usual shell for new OS X accounts), see: http://www.cyberciti.biz/tips/howto-...up-prompt.html
__________________
hayne.net/macosx.html Last edited by hayne; 03-24-2011 at 10:42 AM. |
|
|
|
|
|
#7 |
|
Prospect
Join Date: Jan 2009
Location: South Africa
Posts: 42
|
The problem: the display of my prompt line in my terminal window was too long, I wanted to shorten it.
The solution: Shortened my computer name in computer name in system preferences. (thanks again Hayne) |
|
|
|
|
|
#8 |
|
All Star
Join Date: May 2007
Posts: 654
|
It doesn't really matter, but it probably would have been to look into the prompt customizations available in the shell. I primarily use tcsh, so I can't really give help with the bash syntax.
In a way, it is kind of like living in San Francisco and flying to LA via New York. You get what you want in the end, but it kind of a roundabout way of doing it. There are a lot of options with prompts. I've never been a fan of the computer name, but the worse one was a prompt that displayed the last two commands - that one was annoying, had to change it quickly. HTH, Brett |
|
|
|
|
|
#9 | |||||||||||||||||||||||
|
Site Admin
Join Date: Jan 2002
Location: Montreal
Posts: 31,956
|
Yes, but you had said that you had "already tried that but to [no] avail". So I thought you were going to explain (for the benefit of future readers with the same problem) just what it was that caused the problem, or the confusion, or whatever.
__________________
hayne.net/macosx.html |
|||||||||||||||||||||||
|
|
|
|
|
#10 | |||||||||||||||||||||||
|
Hall of Famer
Join Date: Apr 2007
Posts: 4,262
|
I've actually had this confusion myself. Most people don't realize that the computer name (aka the name of the boot drive) can be different from the network name of the computer, and most people assume blithely that if you change the obvious one (the name of the boot drive) the non-obvious network name will change automatically. Frankly, if unix used the name of the boot drive rather than the network name (and I'm not sure why it doesn't) few people would ever realize that there are two names for the machine. Once you 'get' the fact that there are different names for the machine for different purposes it's all very obvious, but...
__________________
Philosophy is a battle against the bewitchment of our intelligence by means of language. -LW- |
|||||||||||||||||||||||
|
|
|
|
|
#11 | |||||||||||||||||||||||
|
Site Admin
Join Date: Jan 2002
Location: Montreal
Posts: 31,956
|
The name of the boot drive is just (and only) that - the name of a drive. If you boot from a different drive, you probably don't want the name of the machine to change. Note also that the name of the boot drive is not actually used at the Unix level - the boot drive is always referred to as "/" in Unix. It's only in Finder that the name you assign to the drive is visible. (It is also visible at the Unix level as an symbolic link in /Volumes just for consistency with other drives, but this alias is not usually used.)
__________________
hayne.net/macosx.html |
|||||||||||||||||||||||
|
|
|
|
|
#12 |
|
Prospect
Join Date: Jan 2009
Location: South Africa
Posts: 42
|
Goodness, one year later and an upgrade to Lion and I have this problem again. My computer's name in Sharing is "fuboo".
I'd like to shorten the prompt: Change this: vc-gp-n-41-16-229-201:~ m$ To this: fuboo:~ m$Sorry to ask the same question, anyone got any ideas on how to do this? Also, just what is "vc-gp-n-41-16-229-201" and where does it come from? The name of my boot drive (i.e. my only drive) is simply called the default, "Macintosh HD". thank-you. Last edited by michellepace; 03-28-2012 at 03:46 AM. Reason: clarity, and another question |
|
|
|
|
|
#13 |
|
League Commissioner
Join Date: Aug 2006
Posts: 5,071
|
There are several different "names" that your computer goes under.
The "ComputerName", which is the one in the Sharing System Preference. The "LocalHostName", which is the one under the "Edit..." button in the Sharing Pref. This can be different from the ComputerName. There's also a "HostName", which on OS X is "not set". However, typing the Terminal command "hostname" returns the LocalHostName. Typing "scutil --get HostName" returns "not set". The name in the Terminal prompt is normally the LocalHostName. The one you have there looks like it's been assigned by your router, possibly. In the "Edit..." button dialog, make sure that the checkbox "Use dynamic global hostname" is de-ticked. |
|
|
|
|
|
#14 | |||||||||||||||||||||||
|
Moderator
Join Date: Jun 2003
Location: Boulder, CO USA
Posts: 19,560
|
hayne gave you a link to how customize your prompt above in post #6, and that's really the best answer. But if you'd prefer some very specific directions, here you go: I'm assuming that you're using the bash shell. nano ~/.bash_profile If .bash_profile already exists in your home folder, make sure that it contains the line source $HOME/.bashrc If it doesn't exist (the nano command above makes nano open up with no text), then type or copy/paste the source $HOME/.bashrc into it. Save the file in Nano with Control-X, 'y', and hit Return. Now, let's add the line to customize your prompt to ~/.bashrc nano ~/.bashrc First check to see if there's anything there about 'PS1'. If so, move to edit that line. If not, use the arrow keys (or if it's long, you can move down a page at a time with Control-V) to move to the bottom of the file. To get exactly the prompt you requested above all the time, copy/paste the following: export PS1="\r\n\e[1;32mfuboo:\w $\e[0;30m " This above assumes that your Terminal is black text on a white or light colored background. If your normal text is white on a black or dark colored background, then change the above to export PS1="\r\n\e[1;32mfuboo:\w $\e[0;37m " Save with Control-X, 'y', and then hit Return. Now, restart your Terminal window to see your new prompt.
__________________
How to ask questions the smart way |
|||||||||||||||||||||||
|
|
|
|
|
#15 |
|
Prospect
Join Date: Jan 2009
Location: South Africa
Posts: 42
|
Thank-you Trevor, that worked just fine. I followed your steps exactly by creating .bashrc, it worked great.
However, I then wondered if just setting PS1 in .bash_profile would work.. I deleted .bashrc, removed source $HOME/.bashrc from .bash_profile, and added export PS1="\r\n\e[1;32mfuboo:\w $\e[0;30m " to .bash_profile. It worked perfectly too. So just for the interest of knowing, why your suggested preference of using .bashrc? Last edited by michellepace; 03-29-2012 at 05:40 AM. |
|
|
|
|
|
#16 |
|
Moderator
Join Date: Jun 2003
Location: Boulder, CO USA
Posts: 19,560
|
For the long answer, check hayne's FAQ:
http://hayne.net/MacDev/Notes/unixFAQ.html#shellStartup For the short answer, if you do it the way I suggested, you get consistent behavior when you start a new Terminal window, versus when you start the bash shell at the command prompt (for example, by typing bash and hitting Return.) If you skip the extra step, you'll get inconsistent behavior. Trevor
__________________
How to ask questions the smart way |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|