2

What do the values in the prompt mean?

alexey511@rgb-3345:~$ 

I know it is a very basic question. But I am struggling with this problem and I cannot solve it because of the lack of the basic understanding. After googling I didn't find any explanation. (Certainaly it is hidden somewhere in the documentation and one should read probably hundreds of pages to get there).

I'd appreciate your help. I really like to get knowing with Linux but first steps are somehow not easy.

9

The part before the "@"

alexey511

is your username; check with

$ whoami
alexey511

The part between "@" and ":"

rgb-3345

is the hostname:

$ hostname
rgb-3345

The part between ":" and "$"

~ 

is the current working directory, abbreviated to the tilde which is a synonym for your home directory:

$ pwd
/home/alexey511

And finally the "$" is the actual "prompt" sign, indicating you're a normal user (instead of root, in which case it would read "#"), and that command input is expected from you here.

Altogether this is a fairly vanilla shell prompt which is defined and assigned to the environment variable PS1 like this (without color codes for better readability), usually in the file ~/.bashrc:

PS1='\u@\h:\w\$ '

If you want to experiment with it, check out this page:

https://www.howtogeek.com/307701/how-to-customize-and-colorize-your-bash-prompt/

0

The prompt in the terminal is set by the variable PS1.

echo $PS1 shows how it is set in your system, and

man bash and search for the chapter on PROMPTING gets you the possible parameters for the PS prompts.

PS1 is set in .bashrc file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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