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?
bashcommand linemacmacos
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?
Best Answer
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, typeman bash
or visit here for a full list of options.If you just want to change
john
toalex
, then useexport 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.