How to return default PS1 prompt?
After installing docker (I definitely think this is about docker) I got changed cmd-label
. For instance, it was like username@root8hgf858$: your_command
to [:/home/username] $
.
How can I fix it? I've checked current theme in the system settings - it's ok.
screenshot:
[:/home/imran] $ grep PS1 .bashrc /etc/bash.bashrc /etc/skel/.bashrc
/etc/bash.bashrc:[ -z "$PS1" ] && return
/etc/bash.bashrc:PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
/etc/skel/.bashrc: PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
/etc/skel/.bashrc: PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
/etc/skel/.bashrc: PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
Looks like something or the other modified your .bashrc
, since there's no mention of PS1
in it at all. For the moment, make a backup of your .bashrc
and restore the original, and start a new shell:
cp ~/.bashrc{,.bak}
cp /etc/skel/.bashrc ~/.bashrc
/etc/skel
contains a skeleton profile used for setting up a new user's home directory, so it should contain the original .bashrc
you had.
The question is, where is PS1 being set then? Perhaps the new .bashrc
is sourcing other files, so you should examine .bashrc.bak
to see what changes happened.
The prompt is set by using the PS1
variable. This can be defined in several places depending on your setup. If the new prompt is specific to your user, you can run the following command to check which file it is defined in:
grep -H PS1 ~/.bashrc ~/.profile ~/.bash_profile ~/bash.login
If that returns nothing, broaden the search (some of these files shouldn't be relevant but these are all the files that can be read by default bash so you may as well include even unlikely culprits such as ~/.bash_aliases
):
grep -H PS1 ~/.bashrc ~/.profile ~/.bash_profile ~/bash.login ~/.bash_aliases \
/etc/bash.bashrc /etc/profile /etc/profile.d/* /etc/environment 2>/dev/null
Once you have identified the file, open it in a text editor and set your PS1
to whatever you like.