LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-22-2012, 08:49 AM   #1
NotAComputerGuy
Member
 
Registered: Jun 2012
Distribution: Linux Mint - Debian Edition
Posts: 349

Rep: Reputation: 13
Adding Colours in Terminal + SSH


Hi,

Since switching from Ubuntu to LMDE one of the features I miss the most is the colours in my terminal. How can I add Ubuntu like colours in my SSH and local terminals? I think it involves the .bashrc file, but when looking through Duckduckgo for .bashrc files I find them confusing, not really understanding which bits I should be adding.

Can anyone tell me how to add the default Ubuntu colours please?

Thanks
 
Old 06-22-2012, 09:05 AM   #2
fogpipe
Member
 
Registered: Mar 2011
Distribution: Slackware 64 -current,
Posts: 550

Rep: Reputation: 196Reputation: 196
If you are talking about prompts and ls output, put this in your .bashrc to get colored ls output:
Code:
alias ls='ls --color=auto'
This will give you a colored prompt, i use different colors for root vs users and for different machines:
Code:
PS1="[\[\033[1;32m\]\u\[\033[1;31m\]@\[\033[1;34m\]\h\[\033[1;31m\]\[\033[0;32m\]\[\033[1;35m\]:\W\[\033[0m\]]\[\033[0;31m\]$\[\033[0m\]"
This will give you user@hostname /currentworkingdirectory in the title bar of xterm, urxvt etc in an X session:

Code:
case $TERM in   xterm*)



PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME} ${PWD}\007"'

                                ;;
                                  esac
For colored man pages:

Code:
### for color less and man pages
export LESS="-R"
export LESS_TERMCAP_mb=$'\E[01;31m'
export LESS_TERMCAP_md=$'\E[01;31m'
export LESS_TERMCAP_me=$'\E[0m'
export LESS_TERMCAP_se=$'\E[0m'
export LESS_TERMCAP_so=$'\E[01;44;33m'
export LESS_TERMCAP_ue=$'\E[0m'
export LESS_TERMCAP_us=$'\E[01;32m'
All of the above go in your .bashrc which you should backup before editing.

This looks like a pretty good resource for experimenting with colors:
https://wiki.archlinux.org/index.php/Color_Bash_Prompt

And is the first result from google for "colored prompt linux"

EDIT: Just wanted to add that after editing your .bashrc you will need to source that file to see the changes. To do that type:

Code:
. .bashrc
at a prompt in your home directory and then press enter.

Last edited by fogpipe; 06-22-2012 at 09:17 AM. Reason: spelling
 
1 members found this post helpful.
Old 06-22-2012, 10:28 AM   #3
NotAComputerGuy
Member
 
Registered: Jun 2012
Distribution: Linux Mint - Debian Edition
Posts: 349

Original Poster
Rep: Reputation: 13
Hi and thanks for the help, explanations and useful link!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Terminal colours and locale mlpa Slackware 5 09-10-2010 09:40 AM
What terminal or shell colours do you use? jayeola Linux - General 2 08-24-2010 08:16 AM
adding 256 colours to emacs ukwho Programming 1 02-27-2009 02:36 PM
What do the colours mean in the terminal? alaskazimm Mandriva 2 07-04-2004 08:34 AM
How do I get colours in terminal (aterm)? mr-tiddles Linux - General 5 10-23-2003 11:23 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:05 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration