How to use dir_colors to change color of files with executable privileges


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to use dir_colors to change color of files with executable privileges
# 1  
Old 01-19-2011
How to use dir_colors to change color of files with executable privileges

I'm extremely new to UNIX/Linux so apologies if I screw up the terminology.

I'm trying to figure out how to change the color of file names in BASH. For the most part I've got it working out but executable files are giving me some trouble.

I'd like a certain file type (*.inp) to be a different color than everything else, but all of our .inp files have executable privileges. For a few reasons it's really not feasible to change that. I tried adding by file type in the .dir_colors in my home directory:

.inp 01;35

but the line

EXEC 01;32

overrides that. If I delete the "EXEC 01;32" line, the BASH just defaults back to the one in /etc/. Is there any way to make file type override executable privileges in .dir_colors?

Thanks
# 2  
Old 01-19-2011
What is your system? What version of ls do you have? My linux system doesn't even respond to ~/.dir_colors, it reads an environment variable LS_COLORS.
# 3  
Old 01-19-2011
Best bet is to do dircolors -p > ~/.dircolors

Edit your ~/.dircolors and put your .inp at the top (or before EXEC) and then run eval $(dircolors -b ~/.dircolors)

This re-sets up the LS_COLORS env var, and that's what ls --color=auto uses
This User Gave Thanks to Chubler_XL For This Post:
# 4  
Old 01-19-2011
Quote:
Originally Posted by Chubler_XL
Best bet is to do dircolors -p > ~/.dircolors

Edit your ~/.dircolors and put your .inp at the top (or before EXEC) and then run eval $(dircolors -b ~/.dircolors)

This re-sets up the LS_COLORS env var, and that's what ls --color=auto uses
Could you explain what dircolors -p > ~/.dircolors does?

I can't believe I didn't think to put .inp at the top either. I'll give that a shot when I get to work tomorrow. Forum usage is blocked there.

Thanks!
# 5  
Old 01-19-2011
dircolors -p > ~/.dircolors exports the default dircolors configuration to a file name .dircolors in your home directory (replacing the file if it already exists).

This is so that you can start with what ls normally does without a LS_COLORS env var.
This User Gave Thanks to Chubler_XL For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to change the background color in the init 3 mode(not line color)

Hello, I am using RHEL 6.1 on VMware I am searching for a way to change background color (not line by line color wich one can using tput command) basically changing the color of the whole screen to white instead of the default black and changing font color to black and alos would like to... (2 Replies)
Discussion started by: Dexobox
2 Replies

2. UNIX for Dummies Questions & Answers

How to change color when doing echo in tcsh?

Is it possible to change the color when doing an echo? Example, having the following command print in dark blue. echo "Hello" ---------- Post updated at 11:50 AM ---------- Previous update was at 10:25 AM ---------- Just figured out how to do it (2 Replies)
Discussion started by: kristinu
2 Replies

3. Shell Programming and Scripting

Change color on another terminal

i already have a running and working script for remote connection. is there a way to change the terminal color everytime I ssh remotely to another server? this is to avoid confusion since I will be using only one server to remotely access around 50 servers (solaris, linux,. etc) (2 Replies)
Discussion started by: lhareigh890
2 Replies

4. Debian

Change the privileges needed to run a program

Hi everyone, I have an issue with a project of mine. I have to run a program on a terminal which requires to be logged in as su to have it run it. Given that I'm having problem to use expect to give the password I'd like to change the privilege of that program from SU to normal user ( I have the SU... (13 Replies)
Discussion started by: gaisselick87
13 Replies

5. Solaris

How to change folder color in terminal ?

Hi all, I am really new to UNIX ..and can any1 help me on change the yellow color to blur color (folder) ? Please refer to the attached pictures .. Your help is really appreciated .. :) Have a nice day ! (5 Replies)
Discussion started by: sauronlord
5 Replies

6. Shell Programming and Scripting

Change file privileges automatically

Hi, Is it possible to write and run a shell script for specific directory( Apache/htdocs) that changes root privilege read/write to chmod 755 when a program uploads a file (word,PPT,XSL,..) to that directory Thanks, Mk (3 Replies)
Discussion started by: mkohan
3 Replies

7. Linux

DIR_COLORS change in fedora

Hi all, I'm using fedora 6 and I did change the colors in /etc/DIR_COLORS file. The changes are effect everywhere except "root" log in If I open it in a gnome terminal. If I go command line for "root" (Alt+F2) the changes are there but not in root using gnome terminal. For all other users, the... (1 Reply)
Discussion started by: lchokka
1 Replies

8. UNIX for Dummies Questions & Answers

How to change the font or color of text

Hi Gurus, I have a small requirement where i want to change the color & font of some text in a file. i have a file error.txt which will be created in the script using egrep. After that iam adding these lines at head & tail to that file using the following code awk 'BEGIN{print"Please... (4 Replies)
Discussion started by: pssandeep
4 Replies

9. Shell Programming and Scripting

Font Color Change Using .profile

Does anyone know how can I change font color, background color etc for a particular user using .profile? Any help is appreciated. (0 Replies)
Discussion started by: fifo_vs_lifo23
0 Replies

10. UNIX for Dummies Questions & Answers

Change background color in VI editor

Hi, I am new to unix. How can i change the background color in vi? Thank you. -tictactoe (1 Reply)
Discussion started by: tictactoe
1 Replies
Login or Register to Ask a Question