0

Working in Ubuntu, windows terminal, WSL, using Linux:

So I recently asked two questions:

  1. How to bring the colors back to the terminal for a new user
  2. How to change the default user

I solved the first question by creating /home//.bashrc, which didn't previously exist. Copied .bashrc from /etc/skel, and bam, it worked. But then, I solved question 2. Just went into cmd.exe and did: ubuntu2004 config --default-user

And my default login is my new user. But now, the terminal is flat white text again! What can I do to get my colors back without having to source /home//.bashrc every time?

Thanks y'all.

2
  • 1
    OK so I guess I should turn it into an answer ... Commented Mar 26, 2022 at 20:15
  • oh shoot SORRY, I appreciate it. 😅 Commented Mar 26, 2022 at 20:22

2 Answers 2

2

WSL starts an interactive login shell; by default, that reads ~/.profile (or ~/.bash_profile if it exists and your user's login shell is set to bash) in preference to ~/.bashrc.

In Ubuntu, the default ~/.profile then sources ~/.bashrc (if it detects that the shell is bash) so that you get the same environment as an interactive non-login shell.

So what's missing is that you need to copy /etc/skel/.profile to your new user's home directory as well as /etc/skel/.bashrc

Note that if you'd used adduser to create the new user, files in /etc/skel would normally have been copied to the new user's home directory by default.

0

wsl ubuntu 20.04 if you want to set color to root user.

xterm-color) color_prompt=yes;; #line number 33 in my case.

xterm-color|*-256color) color_prompt=yes;; #add this line in .bashrc 

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.