Creating a Custom Prompt in openSUSE 15.3 Leap

I am hoping someone can help a CentOS refusenik. I am the Official Test Guinea Pig and in search of an OS for a pair of workstations. openSUSE is on my short list of candidates because it runs KDE out of the box, so I am putting it through its paces, tricking it out, etc. to see IF it will work, and what problems we will encounter.

One problem – among others – I have so far encountered is the ability to create a custom prompt.

I’m coming over from CentOS (having used Mandrake, Red Hat, Fedora, and RHEL). I am trying​ to create a custom prompt in openSUSE which is EASY in CentOS: => edit /etc/bashrc => find the line that starts PS1 and edit => SAVE. In openSUSE 15.3 Leap I GoTo /etc and find bash.bashrc told NOT to EDIT => create a file called /etc/bash.bashrc.local then go looking for the bash line that starts => PS1 that I wish to edit to now read:

** “$PS1” = “\s-\v\$ " ] && PS1=”\033[1;32m]\033[1;33m]\u\033[1;36m]@\h\033[1;31m]\w\033[1;32m]]\033[1;35m]/>\033[1;37m]"

to create a colorized prompt that looks like this:

root@leopard**/home/cat****]****/> **

or a colorized ~ home prompt that looks like this:


No such luck. I then thought I would get sneaky by installing** zsh** which I am familiar with in CentOS and copy and install my custom theme – cat-theme – that I created but came >-< this close to toasting the system for the second time, but I was able to recover it just in time. Now I am back at square 1: modifying /etc/bash.bashrc (local)… with no idea how to modify it… or even WHERE to modify it. In theory I should only need to copy and paste my PS1 statement SOMEWHERE and SAVE the file, but I’ll be ********** if I know where in /etc/bash.bashrc (.local wherever or however that is created). This is driving me NUTS!!!

**PLEASE HELP!!!**I am sure those old timers that have been hacking openSUSE or SuSE have probably hacked their prompts at one time or the other. Any help you can provide would be greatly appreciated.



In general, you should not create a global bashrc change but rather do so for the user in question.

So, edit ~/.bashrc and add

PS1="\\033[1;32m\]\\033[1;33m\]\u\\033[1;36m\]@\h\\033[1;31m\]\w\\033[1;32m\]]\\033[1;35m\]/>\\033[1;37m\] "

At the end of it. Once you open a new shell, the change should take effect.

FYI, if you’re really into customizing your shell - take a peek at OhMyBash at

and OhMyZSH at

It’s neverending fun of customizing your shell :slight_smile:

Did you check that PS1 actually has default value where and when you test it?

P.S. your message is near to unreadable due to all those rainbow colors and font changes.

I just use Konsole and use the Edit Profile inside of that app.
If you want something even more fun try Yakuake.


If you need to make the change globally – which is what I do to force a short path on the prompt – drop the ‘/etc/bash.bashrc’ changes into ‘/etc/bash.bashrc.local’ …

I still stand behind my “I wouldn’t do it” -thing because you can end up breaking your ability to login with any user or at least cause grey hair :slight_smile:

Yes, the code in ‘/etc/bash.bashrc’ is not for the faint-hearted but, the rule has to be –

  1. From within a user’s session, with root privileges edit ‘/etc/bash.bashrc.local’ and then write the changes.
  2. From another terminal session, “su --login «another user name
    »” … 1. Continue editing ‘/etc/bash.bashrc.local’ until the “su --login «another user name
    »” succeeds … 1. Alternatively, use a remote SSH session to check that the system login succeeds – before you logout from the session being used to edit ‘/etc/bash.bashrc.local’ …

Yes, editing the login scripts can lock you out of the system but, sometimes it pays to “bite the bullet” …