wolfeeh
Posts: 1
Joined: Sat Apr 27, 2019 10:28 pm

Modifying the command prompt

Sat Apr 27, 2019 10:55 pm

Hi all, new to the forums, please be gentle.

So today I have freshly reinstalled raspbian stretch full. Booted with no problems.

One of the first things I did was to create a new user with home directory and somewhere in the process my command prompt has gone from whatever it was (something like "username@hostname $ ") to just "$ ".

Additionally, where using "ls" would print a coloured directory printout everything is now just grey.

Any thoughts on how I could fix this? I thought it might be something to do with the .bashrc file but just to be clear, I haven't altered that in any way.

User avatar
B.Goode
Posts: 10725
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: Modifying the command prompt

Sun Apr 28, 2019 12:14 pm

Welcome to the Raspberry Pi forums.

I am pretty sure you are correct about this being set in .bashrc

But isn't that a per-user configuration file?

On my largely unmodified Raspbian Stretch system that file is located at /home/pi/.bashrc

Won't you need to copy that file, or something similar, to your new user's /home/new_custom_user/.bashrc ?

User avatar
rpdom
Posts: 17736
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Modifying the command prompt

Sun Apr 28, 2019 12:16 pm

B.Goode wrote:
Sun Apr 28, 2019 12:14 pm
am pretty sure you are correct about this being set in .bashrc

But isn't that a per-user configuration file?

On my largely unmodified Raspbian Stretch system that file is located at /home/pi/.bashrc

Won't you need to copy that file, or something similar, to your new user's /home/new_custom_user/.bashrc ?
I think this is one of the differences between the adduser and useradd commands. One installs the default files in the home directory by default and the other needs an option set to do it.
Unreadable squiggle

fbe
Posts: 649
Joined: Thu Aug 17, 2017 9:08 pm

Re: Modifying the command prompt

Sun Apr 28, 2019 1:52 pm

/bin/bash is not the default shell for new users.

Code: Select all

echo $0
If the output is not "-bash"

Code: Select all

chsh -s /bin/bash
or edit /etc/password.

User avatar
B.Goode
Posts: 10725
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: Modifying the command prompt

Sun Apr 28, 2019 3:04 pm

fbe wrote:
Sun Apr 28, 2019 1:52 pm
/bin/bash is not the default shell for new users.

Really?

It is for me. Raspbian Stretch:

After

Code: Select all

sudo adduser my_new_user

I have this entry in /etc/passwd:

Code: Select all

pi@RPi3BplusOffice:~ $ grep my_new_user /etc/passwd
my_new_user:x:1003:1003:My New User,101,2244,3852,4885:/home/my_new_user:/bin/bash

fbe
Posts: 649
Joined: Thu Aug 17, 2017 9:08 pm

Re: Modifying the command prompt

Sun Apr 28, 2019 3:40 pm

You are right. I confused that with useradd behavior. This is a good reason to prefer adduser.
With adduser the bash is the login shell and the prompt should work immediately, useradd (without -s option) uses /bin/sh.

Return to “Beginners”