0

I set my terminal prompt as:

$ echo $PS1
${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]:\n$

It display as:

me@alpha:/:

How could change the username of me to any arbitrary name temporally?

For example change it to spirit@alpah:/:

1

You could use parameter substitution:

PS1="${PS1//\\u/spirit}"

To reverse it,

PS1="${PS1//spirit/\\u}"

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.