LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 12-05-2008, 02:57 PM   #1
zivota
Member
 
Registered: May 2005
Distribution: CENTOS
Posts: 91

Rep: Reputation: 15
Color in bash shell


Hi,

I have two machines both centos 4.7. When I log in to one of them through Putty(SSH) it has display in color, directories are blue, executables are green, if you edit file in vi comments are one color ... commands other and so on. Really cool I like it. They other machine is just plain monochrome. I can't figure out where is set. I thought .bashrc is place to set stuff like this but ... there are absolutely the same.

Weird thing is that I installed both machines and never did anything like that, so I don't know why they are set different?

Any idea where to check?
 
Old 12-05-2008, 03:29 PM   #2
indienick
Senior Member
 
Registered: Dec 2005
Location: London, ON, Canada
Distribution: Arch, Ubuntu, Slackware, OpenBSD, FreeBSD
Posts: 1,853

Rep: Reputation: 65
You can colourize Bash through certain escape-sequences in your ~/.bashrc and /etc/profile files.

However, what you are referring to is colourized output for "ls".

Do the following when you SSH into the monochrome CentOS machine:
Code:
$ echo "alias ls='ls --color=auto'" >> ~/.bashrc
$ source ~/.bashrc
Ta-da! All of your "ls" output will be in colour from now, until forever.
 
Old 12-05-2008, 03:29 PM   #3
indienick
Senior Member
 
Registered: Dec 2005
Location: London, ON, Canada
Distribution: Arch, Ubuntu, Slackware, OpenBSD, FreeBSD
Posts: 1,853

Rep: Reputation: 65
[Duplicate post.]

Last edited by indienick; 12-05-2008 at 04:31 PM.
 
Old 12-05-2008, 04:30 PM   #4
indienick
Senior Member
 
Registered: Dec 2005
Location: London, ON, Canada
Distribution: Arch, Ubuntu, Slackware, OpenBSD, FreeBSD
Posts: 1,853

Rep: Reputation: 65
[Triplicate post. wtf?]
 
Old 12-05-2008, 05:41 PM   #5
wit_273
Member
 
Registered: Mar 2007
Location: Nebraska
Distribution: CentOS
Posts: 82

Rep: Reputation: 15
For color in vim you need to edit /etc/vim/vimrc. Just find the line that says
Code:
#syntax on
and uncomment that line (delete the #). If that line is not in the file just add "syntax on" somewhere in /etc/vim/vimrc. You will have to be root to write to this file.

For others who may read this, is there a way to have a custom vimrc for each user? I read somewhere that you could just create a ~/.vimrc but I tried that and it still uses the /etc/vim/vimrc.

Last edited by wit_273; 12-05-2008 at 05:43 PM.
 
Old 12-05-2008, 06:08 PM   #6
zivota
Member
 
Registered: May 2005
Distribution: CENTOS
Posts: 91

Original Poster
Rep: Reputation: 15
Well thing is ... machine that has coloring on, don't have
-----
$ echo "alias ls='ls --color=auto'" >> ~/.bashrc
$ source ~/.bashrc
-----

and they both have "syntax on" in vimrc but they still behave different. Where's the catch?
 
Old 12-06-2008, 05:31 PM   #7
indienick
Senior Member
 
Registered: Dec 2005
Location: London, ON, Canada
Distribution: Arch, Ubuntu, Slackware, OpenBSD, FreeBSD
Posts: 1,853

Rep: Reputation: 65
Those two lines were command that you type in at the shell.

All they do, is add the line
Code:
alias ls='ls --color=auto'
to the .bashrc file in the user's home directory and "source" the .bashrc file so the changes take effect immediately - ie. you don't need to log out and log back in.
 
  


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
Bash color shell L0CTiT3 *BSD 5 10-22-2008 11:59 AM
how do i chage the color of a file or a directory in a bash shell Paxmaster Linux - Software 3 10-18-2004 12:21 AM
how change text (and background) color within the bash shell? Xavius Linux - Newbie 4 03-29-2004 03:21 PM
Shell Color Tags nocturnal Linux - General 2 05-17-2003 05:13 PM
Shell Color Codes justmoon Linux - General 18 03-16-2003 02:22 PM

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

All times are GMT -5. The time now is 04:52 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration