1

linux noob here. I'm configuring the appearance my terminal via some commands like: vi $HOME/.bashrc then add do this command export PS1="\e[0;32m[\u@\h \W]$ \e[m "

and now my terminal behaves like this terminal appearance

Need your help on resetting the terminal to default appearance

Appreciate if someone can help me. Thanks so much!

BlackSlime
  • 11
  • 2
  • you don't ask a question here. What do you want the prompt to look like? – Esther May 05 '22 at 15:03
  • @Esther Not totally sure, but presumably the OP doesn't want the 18 lines of hostname and wants to fix that... but they still haven't said what they want, so it's hard to know what the right way is. – cocomac May 05 '22 at 15:06
  • Whenever I resize the terminal screen size, the hostname keeps on increasing. then I run the command "clear", it reverts back to just one hostname. I just want to revert the appearance to default. I don't how. Would really appreaciate if someone can help. thanks – BlackSlime May 05 '22 at 15:12
  • Read `man bash`. There's a whole section about prompts – waltinator May 05 '22 at 15:54

1 Answers1

2

The default appearance for PS1 in Ubuntu 18.04 and most likely Ubuntu 20.04 as well is

\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\] \$

if you add to your .bashrc export PS1="\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\] \$ " you can get the default behavior back.

Esther
  • 3,210
  • 11
  • 24
  • this fixed the problem. thanks so much! – BlackSlime May 05 '22 at 15:25
  • IMHO it really doesn't make sense to export the `PS1` variable - it's only meaningful in an interactive shell, and if you're starting an interactive shell as a child of another interactive shell it's going to read PS1 from ~/.bashrc again anyhow. There's a nice discussion at ["export PS1=" for customizing shell prompt](https://askubuntu.com/a/984073/178692) – steeldriver May 05 '22 at 15:51