1

I have a .bashrc file that configures my shell prompt. When I connect to myself with ssh I have this prompt:

jebik@ns3000***:~$ 

When I su myself to another login or when I just launch bash I get this prompt:

jebik:/home/jebik$

This is the one I want, with username and path.

Why is my prompt not the right one when I first connect with PuTTY?

EDIT

When I login via putty i get this prompt:

jebik@ns3000***:~$ 

Which is from /etc/bash.bashrc

And the one I want is this one

jebik:/home/jebik$

From /home/jebik/.bashrc

Here is a list of first commands I do after a login

jebik@ns3000**:~$ echo $PS1
${debian_chroot:+($debian_chroot)}\u@\h:\w\$
jebik@ns3000***:~$ cat /home/jebik/.bashrc
cd

alias ne='emacs'
alias ls='ls --color=auto'
alias ll='ls -lA'

PS1="\\e[0;31m\\u\e[m:\e[0;32m\\w\\e[m$ "
jebik@ns3000**:~$ bash
jebik:/home/jebik$ echo $PS1
\e[0;31m\u\e[m:\e[0;32m\w\e[m$
jebik:/home/jebik$
6
  • Please add a little more detail: What exactly did you do, what did you want to achieve and what happened instead? Did you encounter any warnings or error messages? Please reproduce them in their entirety by editing your question. You can select, copy and paste terminal content and most dialogue messages in Ubuntu. How do I ask a good question? – dessert Nov 3 '17 at 17:06
  • Especially it's unclear which prompt you want, which one you get when you login via ssh and what you need to do to get your desired prompt. Btw, is this an issue with ssh in general or just PuTTY? – dessert Nov 3 '17 at 17:08
  • 2
    Please edit your question and add the content of your ~/.bashrc file in a code block ({} button). – dessert Nov 3 '17 at 17:14
  • 2
    What is the output of printf "%q\n" "$PS1" – glenn jackman Nov 3 '17 at 17:33
  • 1
    Your local prompt and remote machines' prompt can be different. Try to configure the remote machine with same prompt superuser.com/questions/221001/pushing-my-ps1-prompt-over-ssh – Anwar Nov 4 '17 at 4:45
2

When you su you go into the prompt for the other user.

Your .bashrc file that is at /home/jebik/.bashrc will only apply settings to your profile.

There is another version of it for root at /root/.bashrc

There are global settings for all users in the file /etc/bash.bashrc as well.

There are some examples on this page on how to configure the prompt format to your liking. https://www.cyberciti.biz/tips/howto-linux-unix-bash-shell-setup-prompt.html

1
  • Ok apparently for some reason it get the PS1 from /etc/bash.bashrc the first time i login. any idea why? – Jebik Nov 6 '17 at 9:24

Not the answer you're looking for? Browse other questions tagged or ask your own question.