Question

colorize bash prompt?

  • Posted February 14, 2014

hi,

I want to colorize my bash prompt, and added .bash_profile in my home dir (/root):

----8<-------- #############################################################################

export PS1=‘[\033[01;31m]\u[\033[01;33m]@[\033[01;36m]\h [\033[01;33m]\w [\033[01;35m]$ [\033[00m]’ umask 022

#############################################################################

eval “dircolors

#############################################################################

alias ls=‘ls $LS_OPTIONS’ alias ll=‘ls $LS_OPTIONS -l’ alias l=‘ls $LS_OPTIONS -lA’ alias …=‘cd …’ alias …=‘cd …/…’ alias s=‘ssh -l root’

#############################################################################

export EDITOR=“nano”

export HISTFILESIZE=99999999 export HISTSIZE=99999999 export HISTCONTROL=“ignoreboth”

export LS_OPTIONS=‘–color=auto -h’

############################################################################# #naj:

if [ -f ~/.bashrc ]; then source ~/.bashrc fi ----8<--------

that did not work, and adding above to .bashrc either.

How can I get bash colorized?

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

To try it first without saving type: <br><pre>export PS1=“\e[0;32m[\u@\h \W]$ \e[m “</pre> <br> <br>If the color is ok then you can save it to your user’s .bashrc typing: <br><pre>export PS1=”\e[0;32m[\u@\h \W]$ \e[m”</pre> <br> <br>

<br>thanks ricardo! <br>it works!!! <br>