I assume you want the current working directory to show in your prompt.
According to your screenshot, your prompt is showing only your machine name. The output you gave for echo $PS1
doesn't even give me that... I can't replicate your prompt without a bit of tinkering: maybe you have: \[\e]0;\u@\h: \w\a\]\H\$
or... you're using a different shell maybe??
Here is the code for a really simple prompt that shows the username, computer name, and current working directory (enter this in a terminal to test):
PS1="\u@\h:\w$ "
But probably you want the working directory in your prompt AND in the window title... the normal prompt in Ubuntu is this:
\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\u@\h:\w\$
which is set in ~/.bashrc
by:
# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color|*-256color) color_prompt=yes;;
esac
# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes
if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
color_prompt=yes
else
color_prompt=
fi
fi
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\$ '
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
So maybe you put something in your .bashrc
to override that. Have a look at the end of it for lines like
export PS1="some code here"
or
PS1="some code here"
export PS1
To see if it has been overridden, and comment out those lines if they are there (put #
at the start of the line) or just remove them.
You can also check that the section I pasted above (line 38-73 in my .bashrc
) exists and hasn't been changed, if you just want to restore the normal prompt.
To get a completely clean .bashrc
mv ~/.bashrc{,.bak} && cp /etc/skel/.bashrc ~/.bashrc
If you want to customise your prompt, you can keep playing around until you get what you want... this site is helpful for reference.
When you have what you want add to .bashrc
export PS1="your code here "
Also see one of my favourite AU questions
echo $PS1
? – Zanna Aug 13 '16 at 06:07