Visit Our UNIX and Linux User Community


dirs & colors


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers dirs & colors
# 1  
Old 07-13-2001
Question dirs & colors

hi @all

question from an absolute beginner:

I want directory listings to be displayed with different colors...

what do I have to do and where can I find the settings?

thx

Last edited by tk876; 07-13-2001 at 12:41 PM..
# 2  
Old 07-13-2001
Hi,



if you're using the bash shell you could create an alias for the "ls" command using the color option to differentiate file types.



i.e. in your ~/.bash_profile file add



alias ls='ls --color="always"'

On my system the colours for different file types are a follows:



executable files green

archive files (.gz,.zip,etc,) red

ascii files white

jpgs,bmp files magenta

symbolic links cyan

directories blue



I'm not sure if you can change the colours for different file types.





Andy Hibbins Smilie
# 3  
Old 07-13-2001
I've made the changes and it works fine...

but how can I define the colors for dirs, ascii files etc.

thanks again
thomas
# 4  
Old 07-13-2001
To alter the colours for different file type you need to edit the dircolors config file.



On my system this is installed under /etc/DIR_COLORS



you may also need to add the following to /etc/profile or ~/.bash_profile file



eval `dircolors -sh /etc/DIR_COLORS`


I don't need to add this to my /etc/profile ~/.bash_profile because it get's executed vi a script called color_ls.sh in the /etc/profile.d directory.




Andy Hibbins Smilie

# 5  
Old 07-17-2001
Hi

One more thing you can do is copy the /etc/DIR_COLORS file to your home directory as .dir_colors file and then edit it. The /etc/DIR_COLORS file have all the necessary information as well as the color codes to display your files or directories in diferrent color codes.
Hope This works
 

Previous Thread | Next Thread
Test Your Knowledge in Computers #438
Difficulty: Medium
TypeScript is a free and open-source subset of JavaScript developed by Microsoft.
True or False?

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

**HELP** how to do a listing of dirs and all sub dirs only

I am trying to get a listing of ALL directories only under /export (as an example). I can get all the dirs directly under /export but I need any sub dirs under those dirs. I've looked (here and google) but can not find anything that works (4 Replies)
Discussion started by: bbraml
4 Replies

2. UNIX for Dummies Questions & Answers

Move directory + sub dirs

Hi Im quite new at this so I will try to explain what need to do and I hope you can give me some pointers & tips. On this scenario I have 3 users AriStar Userno1 Userno2 Userno1 has one directory (with sub dirs), all directories have certain files with different restrictions. What I... (1 Reply)
Discussion started by: AriStar
1 Replies

3. Shell Programming and Scripting

creating & sending formatted (with bolds & colors) CSV

Hi , I have a situation. Need is to create & send a formatted file with header in BOLD & colored & some sequel results as a content. I know echo -e \033 command, but its scope is limited in PUTTY. How to retain the formatting out of Putty; say after someone opens a email attachment... (2 Replies)
Discussion started by: infaWorld
2 Replies

4. Solaris

Why are so many dirs used in solaris hierarchy?

Hi all, I would like to know the difference between the different dir structures present in solaris!!! Meaning what does /usr contain, /etc ,/opt/ ,so on... I know what /usr and /etc are used for. But why are /opt /bin /sbin /var and many more that i have missed I would appreciate if... (1 Reply)
Discussion started by: wrapster
1 Replies

5. UNIX for Dummies Questions & Answers

.bashrc question re: rm -i & ls --colors

QUESTION #1: I have this in my .bashrc file: alias rm='rm -i' Problem is, there are 3 files that I remove many times a day and would like this command to ignore these 3 files. In other words, prompt me on everything EXCEPT these 3 files. Is this possible? QUESTION #2: Also in... (16 Replies)
Discussion started by: kthatch
16 Replies

6. Shell Programming and Scripting

monitoring dirs

Hi there, Presently using du -ks and storing all directory summaries manually. Is there any other way or easier way to accomplish monitoring directories and check everyday/week for updates on particular dirs that I am interested in. Automation of this functionality maybe? (1 Reply)
Discussion started by: da-seot
1 Replies

7. Shell Programming and Scripting

how to synchronize different dirs

I have 4 directory Dir1 file1 file2 file3 file4 Dir2 file3 file5 file6 file8 Dir3 file1 file2 file6 file9 file10 Dir4 file3 file6 file12 file15 and all the 4 dirs are having couple of files. Few of the files are common to other directory/ies and few... (1 Reply)
Discussion started by: reldb
1 Replies

8. UNIX for Dummies Questions & Answers

Making dirs in a partition

I am setting up a design tools server on a machine running Solaris9. I want to setup a partition that contains a number of design tools. If I go to / and type mkdir "tools" then I am on the root partition. How do I get "/tools" to be on a separate partition? (I also have the same problem... (2 Replies)
Discussion started by: smo59
2 Replies

9. UNIX for Dummies Questions & Answers

Combining Two Dirs

I have two Directories, foo and foobar. I want to combine the contents of foo into foobar. There is probably a simple command for this, but I have yet to find it. Thanks in advance, Robert (2 Replies)
Discussion started by: Phobos
2 Replies

10. UNIX for Dummies Questions & Answers

I need to ls all files in 4-6 deep dirs

I need to print to file , a listing of all files below a certain directory. Example: I need to print to file a listing of all files below the etc dir (including the subdirectories) with their full path. Any ideas on how to do this with one command. Or is this something I need to do on all... (4 Replies)
Discussion started by: gforty
4 Replies

Featured Tech Videos