I opened my terminal and saw a shell prompt.

 Last login: Fri Feb 15 15:28:16 on ttys000
 john:~ voloda2$ 

How do I change john to alex?

  • 1
    "john" is either the user or the computer name. Why do you want to change it? – nohillside Feb 15 '13 at 13:11
  • 1
    I do not like John. It is a bad guy. – Voloda2 Feb 15 '13 at 13:14
  • Then it sounds more logical to change your computer- and/or username first. – Gerry Feb 15 '13 at 15:50

Add the following line to the end of your ~/.bashrc:

export PS1='\u:\W \$ '

Your prompt should now be voloda2:~ $, which is your username, a colon, the current working directory, and a $ if you are a regular user, or a # if you are root. For more prompt customization options, type man bash or visit here for a full list of options.

If you just want to change john to alex, then use export PS1='alex:\W \u \$ '. john is the name of your computer, so if you have appropriate administrator privileges open System Preferences, select Sharing and change the name to whatever you want, and your prompt will automatically update. However, if you are on a network, at work, or using a shared computer, talk to your local system admin before doing this.

You must log in to answer this question.

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