You are not logged in.

#1 2013-02-22 15:16:46

Issam2204
Member
Registered: 2013-02-20
Posts: 20

[SOLVED] Terminal and Colored Output

Hello everyone!

I was messing around a bit in the Wiki and a read about this great way to color the terminal's output.

I was following this one https://wiki.archlinux.org/index.php/Co … er_prompts

The problem is the root output. It remains the same as the user text (white bold). If I press

# source ~/.bashrc

i get what i want but when i exit adn re-enter it's still white bold text.

There is anyway to make it permanent? I guess it should be permanent right?

Thanks for reading!

Last edited by Issam2204 (2013-02-22 16:02:44)

Offline

#2 2013-02-22 15:32:08

skanky
Member
From: WAIS
Registered: 2009-10-23
Posts: 1,847

Re: [SOLVED] Terminal and Colored Output

Works for me - assuming you're talking about using su?
Can you post your root's .bashrc?


"...one cannot be angry when one looks at a penguin."  - John Ruskin
"Life in general is a bit shit, and so too is the internet. And that's all there is." - scepticisle

Offline

#3 2013-02-22 15:36:35

Issam2204
Member
Registered: 2013-02-20
Posts: 20

Re: [SOLVED] Terminal and Colored Output

#
# ~/.bashrc
#

# If not running interactively, don't do anything
[[ $- != *i* ]] && return

alias ls='ls --color=auto'
#PS1='[\u@\h \W]\$ '

PS1='\[\e[0;31m\]\u\[\e[m\] \[\e[1;34m\]\w\[\e[m\] \[\e[0;31m\]\$ \[\e[m\]\[\e[0;32m\]'



This is strange: when i type "su" it works. But generally i type "su -" and with that it doesn't work.

Thanks for the correct assumption. Any idea how to make it work with "su -"?

Offline

#4 2013-02-22 15:52:11

skanky
Member
From: WAIS
Registered: 2009-10-23
Posts: 1,847

Re: [SOLVED] Terminal and Colored Output

su -

is a synonym for

su --login

Which starts a login session. In Bash (at least) a login session calls .bash_profile, not .bashrc. So you have three options -

1) Put the prompt also in your .bash_profile for root (you'll need to create one, and may want to look at the system default ones to make sure you don't remove any settings)

2) Create .bash_profile and source .bashrc from it. That way you only have to edit the prompt line in one place. It's what many (maybe even Arch by default, I forget) do in their user settings.

3) Some other that I haven't thought of.


"...one cannot be angry when one looks at a penguin."  - John Ruskin
"Life in general is a bit shit, and so too is the internet. And that's all there is." - scepticisle

Offline

#5 2013-02-22 16:00:09

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: [SOLVED] Terminal and Colored Output

3) some other option... create a color configuration file and source it at a global level... though this might not be entirely advisable. I guess you could create that color profile and just source it from every possible .bash*

Offline

#6 2013-02-22 16:01:20

Issam2204
Member
Registered: 2013-02-20
Posts: 20

Re: [SOLVED] Terminal and Colored Output

I tried the second one and it did the trick!

Thank you very much skanky for your time and help!

Thank you WonderWoofy for your time as well!

Last edited by Issam2204 (2013-02-22 16:02:19)

Offline

Board footer

Powered by FluxBB