Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?

share|improve this question
    
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. –  Herman Torjussen Feb 20 '12 at 16:30
add comment

2 Answers 2

up vote 8 down vote accepted

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.

share|improve this answer
add comment

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
share|improve this answer
    
(+) or chsh -s /bin/bash worked for me. –  capdragon Sep 22 '12 at 14:30
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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