0

When I use Linux console it shows way to current directory "admin@servername:/home$" or not - just "$". How to turn on/ off this hint (way to directory)? Probably it should be changes in file .bashrc in PS1 = '\u@\h:\w$', but this value in PS1 allready. Here is code sample from .bashrc:

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

What exactly should be done to show/ hide way to current directory? Thankyou in advance.

2
  • 2
    Questions about configuring your interactive environment, as opposed to about developing software, are better placed at Unix & Linux or Super User. Commented May 3, 2022 at 19:56
  • @CharlesDuffy thank you for advice, I just start working with Linux server. Commented May 4, 2022 at 4:43

1 Answer 1

2

You should look up Bash prompt special characters.

As you can see in the list, the current working directory is \w, and \a is the bell character, so just remove those.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.