9

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?

1
  • 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
    Commented Feb 20, 2012 at 16:30

2 Answers 2

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.

7

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 /bin/bash
3
  • 1
    (+) or chsh -s /bin/bash worked for me.
    – capdragon
    Commented Sep 22, 2012 at 14:30
  • 1
    And don't forget to reboot before seeing the results. Thanks guys!
    – Shivid
    Commented Jul 20, 2022 at 9:55
  • Using just bash gave me chsh: bash is an invalid shell, but it worked with /bin/bash Commented Jun 22 at 8:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .