How do you change your prompt variable to display the current working directory (pwd), meaning so that when a directory is changed the prompt also changes to reflect the current directory you are in
1 Answer
I'm pretty certain the default prompt already does that, but here it is, for reference:
muru@muru-pc:~$ echo $PS1
${debian_chroot:+($debian_chroot)}\u@\h:\w\$
The important bit is the \w
part. You can set it to \W
for only the name of the current directory (basename $(pwd)
).
Check out the full list at TLDP.
PS1
variable.