0

Everytime I start terminal, it says dhcp instead of my account name. Why is this and how do I exit out of it?

dhcp-205122:~ NAME$ 
1

In some more sophisticated networks, the prompt may be overwritten by the network providing you with the name given by the DHCP server there. This may be particularly obvious, if instead of your account the computer's hostname is displayed.

How to change it:

  1. Open Terminal
  2. Type in sudo nano /etc/profile (you need to be part of the administrators group to submit this command)
  3. Look for a line starting with PS1=; if there is no such line, you can add it at the end (see example below)
  4. To include the user, add \u to the line

To give you an example of a working line, my personal favorite is: PS1="\u@\h:\w \$ "

Here is what it does:
\u adds the user name
\h adds the hostname
\w adds the full current working directory
\$ adds a $ sign for all regular users and a # while logged in as root.

All other characters in the mix are representing themselves. So, such a prompt would convert to something like the following:
blackmouse@bm-computer:/Library/Application Support $
User and computer name are fictive as I, for obvious reasons, do not know your real computer user or computer name and the path will change to whatever directory you are in.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .