4

I was in the middle of installing updates for Ubuntu when I came across an error, which allowed me to "Start a new shell to examine the situation". Doing so placed me at the top of my directory structure in the same window but appending # to the end.

What does the # represent?

How is this change achieved from the command line?

Zanna
  • 72,312
Struan
  • 53

1 Answers1

6

It sounds like you were given a root shell. A root shell is typically indicated with a hash sign (#) as opposed to a user shell which is usually indicated with a dollar sign ($).

Whether or not there is a directory name or user name as well depends on the particular shell in use, as a root shell could look like any of the following:

#
/#
/dir#
username:/dir#
username@hostname:/dir#

The last of the above examples is the default prompt in Bash in Ubuntu. The first is the default in the dash shell. Try it with /bin/sh. Of course this is configurable in both.

To open a root shell, the shortcut is:

sudo -i

This opens the root user's configured shell as a login shell, which will usually be bash. It's a shortcut to sudo su -. If you want to open a different shell as root, without modifying the root user's configured shell, you can use the long-winded:

sudo su -s /bin/sh -

Replace /bin/sh with the shell you want to open.

thomasrutter
  • 37,804