Will is bored Dev and Computer Stuff…


Updating Hostname (in terminal/bash)

I've been configuring my computer a bit, including setting up my .bash_profile file, and some bash aliases.

After setting up a custom bash prompt (I used a typical configuration):
export PS1="\u@\h[\w]$ "
I noticed that my bash prompt looked like this: 'will@unknown-0064ee1608a0[~]$' - pretty lame, why does it say unknown?

After doing some searching I found out that my host name needed setting (or updating?).

The command to do that is:
scutil --set HostName YOURHOSTNAME (I found that info here: http://osxdaily.com/2010/09/06/change-your-mac-hostname-via-terminal/ - thanks!)

YOURHOSTNAME would of course be replaced with whatever you want, and it doesn't have to be all caps.

Now it looks like this: 'will@1405[~]$' - still pretty lame, I know, but it's relevant (to me - I swear!) and better than unknown...

scutil, as it turns out, is a utility that let's you manage system configuration parameters. I'm not sure whether or not it will come in handy in the future, but so far it has helped me solve one small thing!

Comments (2) Trackbacks (0)
  1. Thank you so much for helping me over this hump. Lame for sure, but you made my day!

  2. Just what I was looking for – I had been looking at a god-awful prompt for far too long.

    Thanks for the help!

Leave a comment

No trackbacks yet.