Need help to change the command prompt. I want short name. Look below :
kirti@kirti-Aspire-5733Z:~$ cd workspace
kirti@kirti-Aspire-5733Z:~/workspace$ cd Ruby
kirti@kirti-Aspire-5733Z:~/workspace/Ruby$
I am looking for my initial command prompt, when I will open it using 'Ctrl+Alt+t' as
$(arup):
$(arup): cd workspace
$(workspace): cd Ruby
$(Ruby) :
In my ~/.bashrc
file did put as below :
if [ "$color_prompt" = yes ]; then
PROMPT_DIRTRIM=1
PS1='\w\ $ '
else
PS1='\w\ $ '
By replacing
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
# PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
PS1='arup :\w\$ '
fi
unset color_prompt force_color_prompt
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
;;
*)
;;
esac
But I didn't find any change in my shell:
May I have some help to configure the above settings ?
I took help from How to: Change / Setup bash custom prompt (PS1)
I did first
sudo gedit /etc/bashrc
. Then did below change :Now my prompt is coming close to my expectation -
you can create an alias for
cd ~/workspace/Ruby
aschg_dir
In
~/.bashrc
, search for section:Remove the
@\h
, and replace the\w
with an uppercase\W
, so that it becomes:check this for more info
in .bash_profile, enter
this applies to root user on 17.04 onwards, and to all users on 16.04
then in relevant .bashrc or /root/bashrc, update the color_prompt section as below.