5

I have an Ubuntu server that I administer through ssh. When I login as root I get a full path in the prompt, like /var/www. I created a user with sudo privileges for the purpose of administration. When I login, all I see in the command prompt is a $ sign. Is there a fix for this?

  • Look inside root's /root/.bashrc file or the global /etc/bash.bashrc file to see the value of the PS1 variable for the root user and the system's defaults, respectively. – user13742 Feb 20 '12 at 16:30
8

This is controlled by the PS1 environment variable. You can see what this is by running, as root, echo $PS1. You can then set the variable in your own bash profile with echo 'PS1=<value of PS1>' >> ~/.bashrc.

You can google for lots of possible values of PS1, but the part you are currently missing is \w for working directory.

3

If you see just $ as a prompt, it's most likely that you're running dash. Dash is a stripped-down shell with little more than POSIX standard features. It's intended to run scripts, and it's more efficient (both in terms of memory and in terms of processor speed) than bash. Dash doesn't have any fancy interactive feature. Under Ubuntu, /bin/sh is a symbolic link to dash.

If you intend to log in as that user interactively, I recommend changing your login shell to bash:

chsh -s bash
  • (+) or chsh -s /bin/bash worked for me. – capdragon Sep 22 '12 at 14:30

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.