0

can someone assist, i would like to return to my normal terminal that has $ root symbol. Right now am in terminal with # root symbol saying bash, how do i get back to the $ root

  • Press the two buttons CTRL+D. – user68186 May 24 '23 at 21:32
  • Or you can type exit – Will May 24 '23 at 21:46
  • both CTRL + D and exit is not working, can you assist me to get out of bash –  May 24 '23 at 21:53
  • 1
    I think you may be misusing the term "root." There is a typical user prompt ($), and there is a typical root prompt (#). Both can be customized to something else. So your phrase "normal terminal that has $ root symbol" could be interpreted two different ways. – user535733 May 24 '23 at 23:46

2 Answers2

1

The symbol that you see doesn't really matter too much, other than a customisable indication of which user is logged in. The command prompt that you see is highly customisable using the PS1 environmental variable.

If you want to know which user you are currently logged in as, the command you need is: whoami

If you want to switch to another user, try:

su <username>

or ctrl-D to exit the current shell and return to your previous shell.

moo
  • 878
0

Your question seem to be about the special variable \$ that are available in the Bash prompt, which is also explained here.

The variable \$ in the PS1 prompt is really simple:

  • \$ expands to # for root (UID = 0) and $ for all other users.

In relation to your question, this means that if the prompt shows #, then you ARE logged in as root. If you then type exit and Enter and the prompt now shows $, this means you ARE NOT logged in as root.

The variable \$ is simply a quick way to indicate whether you're logged in as root (UID = 0) or not.

Artur Meinild
  • 26,018