0

Can you please describe and explain each part of the command prompt

pi@raspberrypi ~ $ 

This is what I saw when I first logged in to my Linux computer.

1 Answer 1

5

You can set this with the PS1 environment variable.

  • pi is the username.
  • raspberrypi is the name of the server.
  • ~ is the current directory (and means 'home dir')
  • $ is the prompt - $ denotes a non privileged user. (# denotes root).

PS1 is probably set to:

PS1='\u@\h \w \$' 
3
  • 1
    A nice how-to: tldp.org/HOWTO/Bash-Prompt-HOWTO/index.html Commented Jun 15, 2015 at 10:44
  • 1
    Please note that $ and # are by convention only, not enforced based on the user id in bash in any way. Nor is the username, hostname etc guaranteed to be used in the PS1, they could be fixed strings, although of course most likely they are. The prompt on the bananapi I have access to looks exactly the same, but its PS1 is more complex (it is for zsh, with colors in the prompt). Commented Jun 15, 2015 at 11:02
  • The \$ option in the PS1 does the $ to # transition automatically. Most of the above could be static, but I've assumed not when it's trivial to do it dynamically. Commented Jun 15, 2015 at 11:33

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.