LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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-30-2006, 12:27 AM   #1
User Name.
Member
 
Registered: Aug 2006
Distribution: Ubuntu 8.04
Posts: 178

Rep: Reputation: 30
~/.bashrc ; Editing.


How do I change of color current directory, input text, and such in ~/.bashrc ? Thanks.

Last edited by User Name.; 12-30-2006 at 12:32 AM.
 
Old 12-30-2006, 12:44 AM   #2
PatrickNew
Senior Member
 
Registered: Jan 2006
Location: Charleston, SC, USA
Distribution: Debian, Gentoo, Ubuntu, RHEL
Posts: 1,148
Blog Entries: 1

Rep: Reputation: 48
this link should just about cover it.
http://news.softpedia.com/news/How-t...pt-40033.shtml
 
Old 12-30-2006, 12:13 PM   #3
User Name.
Member
 
Registered: Aug 2006
Distribution: Ubuntu 8.04
Posts: 178

Original Poster
Rep: Reputation: 30
How do I change the colors of output text? So directorys are blue, executables are green, and such?

This is my current .bashrc file:
Code:
# Defines colors
Black="$(tput setaf 0)"
BlackBG="$(tput setab 0)"
DarkGrey="$(tput bold ; tput setaf 0)"
LightGrey="$(tput setaf 7)"
LightGreyBG="$(tput setab 7)"
White="$(tput bold ; tput setaf 7)"
Red="$(tput setaf 1)"
RedBG="$(tput setab 1)"
LightRed="$(tput bold ; tput setaf 1)"
Green="$(tput setaf 2)"
GreenBG="$(tput setab 2)"
LightGreen="$(tput bold ; tput setaf 2)"
Brown="$(tput setaf 3)"
BrownBG="$(tput setab 3)"
Yellow="$(tput bold ; tput setaf 3)"
Blue="$(tput setaf 4)"
BlueBG="$(tput setab 4)"
LightBlue="$(tput bold ; tput setaf 4)"
Purple="$(tput setaf 5)"
PurpleBG="$(tput setab 5)"
Pink="$(tput bold ; tput setaf 5)"
Cyan="$(tput setaf 6)"
CyanBG="$(tput setab 6)"
LightCyan="$(tput bold ; tput setaf 6)"
NC="$(tput sgr0)" # No Color

# Displays [time][host>dir]$ 
PS1='\[$White\][\[$Red\]\T\[$White\]][\[$Purple\]\h\[$White\]>\w]\$\[$Green\] '
I think it's a bit overdone, but it looks nice.

edit:
And I want to create a command that will display distro, kernel and such. An alias would work.
Alot like this:
http://news.softpedia.com/images/rev...img2-large.png

Last edited by User Name.; 12-30-2006 at 12:21 PM.
 
Old 12-30-2006, 12:46 PM   #4
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
Quote:
Originally Posted by User Name.
How do I change the colors of output text? So directorys are blue, executables are green, and such?
Set the LS_COLORS environment variable, see man dircolors for info.
 
Old 12-30-2006, 02:12 PM   #5
User Name.
Member
 
Registered: Aug 2006
Distribution: Ubuntu 8.04
Posts: 178

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by Nylex
Set the LS_COLORS environment variable, see man dircolors for info.
I don't exactly under stand what you mean. I checked the man, it didn't give much information. The --help file gave the same as man. Can you explain this better?
 
Old 12-30-2006, 02:33 PM   #6
PatrickNew
Senior Member
 
Registered: Jan 2006
Location: Charleston, SC, USA
Distribution: Debian, Gentoo, Ubuntu, RHEL
Posts: 1,148
Blog Entries: 1

Rep: Reputation: 48
to handle the LS_COLORS, it is easier to add to the end of your bashrc the line
alias ls="ls --color=auto"
 
Old 12-30-2006, 02:58 PM   #7
User Name.
Member
 
Registered: Aug 2006
Distribution: Ubuntu 8.04
Posts: 178

Original Poster
Rep: Reputation: 30
Thanks, but is there anyway that I could make it so a special file is a cetain color though? Like pictures? Or text files?
 
Old 12-30-2006, 03:31 PM   #8
PatrickNew
Senior Member
 
Registered: Jan 2006
Location: Charleston, SC, USA
Distribution: Debian, Gentoo, Ubuntu, RHEL
Posts: 1,148
Blog Entries: 1

Rep: Reputation: 48
Ah, now I understand the question. Unfortunately I don't know the answer. Sorry.
 
Old 01-01-2007, 01:52 AM   #9
bartonski
Member
 
Registered: Jul 2006
Location: Louisville, KY
Distribution: Fedora 12, Slackware, Debian, Ubuntu Karmic, FreeBSD 7.1
Posts: 443
Blog Entries: 1

Rep: Reputation: 47
The command 'ls' uses the environment variable $LS_COLORS to determine display of colors.

on my system, it looks like this:

Quote:
Code:
>echo $LS_COLORS
no=00:fi=00:di=00;34:ln=00;36:pi=40;33:so=00;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=00;32:*.cmd=00;32:*.exe=00;32:*.com=00;32:*.btm=00;32:*.bat=00;32:*.sh=00;32:*.csh=00;32:*.tar=00;31:*.tgz=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.zip=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.bz=00;31:*.tz=00;31:*.rpm=00;31:*.cpio=00;31:*.jpg=00;35:*.gif=00;35:*.bmp=00;35:*.xbm=00;35:*.xpm=00;35:*.png=00;35:*.tif=00;35:
LS_COLORS is set by the program dircolors.

The default colors used by dircolors are compiled in, and can be viewed by using the command

dircolors --print-database

The output from this command can be re-directed to a file, the output can be modified and used as the control file for dircolors.

Here's the step by step:

Quote:
Code:
dircolors --print-database > $HOME/.dircolors

vim $HOME/.dircolors

# edit $HOME/.dircolors, change colors however you want.
Then edit $HOME/.bashrc, put the following commands in:

Quote:
Code:
LS_COLORS = 'dircolors -b $HOME/.dircolors'
alias ls='ls -hF --color=tty'
now... I haven't actually done any of this, you may have to jigger a command or two, but I believe that I'm at least 95% of the way there.

By the way, the documentation for dircolors can be found by using 'info dircolors'.
 
  


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
problem after editing .bashrc ashley75 Linux - General 3 10-20-2004 06:49 PM
Editing .bashrc AceKidCool Linux - Newbie 3 11-27-2003 11:46 PM
Editing path permanently...but I don't have .bashrc or .profile shock_ez Linux - Newbie 6 07-02-2003 06:16 PM
~/.bashrc editing TX_metalhead Linux - General 1 07-19-2002 03:29 PM
Editing /etc/bashrc qadir Linux - Software 2 07-06-2002 05:14 AM


All times are GMT -5. The time now is 10:24 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