Admin user not showing directory path in console prompt, only $

9,724

Solution 1

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.

Solution 2

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:
9,724

Related videos on Youtube

Daddy
Author by

Daddy

i like programming!

Updated on September 18, 2022

Comments

  • Daddy
    Daddy almost 2 years

    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?

    • Admin
      Admin over 12 years
      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.
  • David Stelfox
    David Stelfox almost 12 years
    (+) or chsh -s /bin/bash worked for me.