2

This is what I presently see in Mac Terminal as always

EN-AAABBBB:~ username$

My understanding is that EN-AAABBBB is my Mac name, followed by username. But I would like to transform this into this format

username@pwd$

How do I achieve this? Other customization tips are welcome :) [Colors etc..]

Note: I tried adding PS1='\u@ \W \$ ' to .bash_profile, and am now getting the result as

username@ ~ $

\w or \W should display working directory, but it is not. Any help?

1

This thread was useful in figuring out how to accomplish this.

This is what I'm using:

PS1="\H@\u: \$(pwd)> "
  • \H stands for Hostname
  • \u stands for username
  • \$(pwd) prints the present working directory.
  • 2
    ~ is your /home/user directory so what you were doing was working. If you have a directory below, had you put \w instead of $(pwd), that would show you ~/directory_below. You may also try adding something like [$?] to your line which would show you the exit status of the last command, in brackets... – user44370 Jun 6 '14 at 11:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.