I am on Ubuntu 19:10 and there is a file called .bashrc
in my home directory. I can see it with the file-explorer by showing hidden files with CTRL+H
and open it with my default text editor via double click (my default user permissions are good - no sudo
stuff needed in home).
There is a lot of configuration script and in between this:
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
based on Pauls answer I changed the lower-case \w
to capital \W
. It now looks like this…
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
… and the terminal prefix is now user@my-laptop:some_folder$
Sidenote: [\033[01;32m\]
these things are color codes
Hope this helps some GUI veterans :)
Hide current working directory in terminal
– Suvasish Sarker Jun 01 '13 at 02:41