Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
colored console
View unanswered posts
View posts from last 24 hours

Goto page 1, 2  Next  
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
Daemon
n00b
n00b


Joined: 18 Apr 2002
Posts: 65

PostPosted: Wed Apr 24, 2002 2:16 pm    Post subject: colored console Reply with quote

hi... how do i get ls to list directories and links with colors?

(i really searched hard b4 posting... it's not answered anywhere else :wink: )
Back to top
View user's profile Send private message
dice
Guru
Guru


Joined: 21 Apr 2002
Posts: 577

PostPosted: Wed Apr 24, 2002 2:28 pm    Post subject: Reply with quote

http://www.linux-sxs.org/lscolors.html
Back to top
View user's profile Send private message
Daemon
n00b
n00b


Joined: 18 Apr 2002
Posts: 65

PostPosted: Wed Apr 24, 2002 3:57 pm    Post subject: Reply with quote

doh! :oops:
Back to top
View user's profile Send private message
Malakin
Veteran
Veteran


Joined: 14 Apr 2002
Posts: 1692
Location: Victoria BC Canada

PostPosted: Thu Apr 25, 2002 2:04 am    Post subject: Reply with quote

Everyone seems to like this, maybe it can be made a Gentoo default?

One of the first things I did after installing Gentoo was setup the aliases so I had colors and directories identified, just seems logical to me.
Back to top
View user's profile Send private message
dArkMaGE
Apprentice
Apprentice


Joined: 20 Apr 2002
Posts: 152

PostPosted: Thu Apr 25, 2002 2:30 am    Post subject: Reply with quote

shouldnt colors be set up for non-root users anyways?
Back to top
View user's profile Send private message
snutte
Apprentice
Apprentice


Joined: 24 Apr 2002
Posts: 181
Location: Sweden, Malmö

PostPosted: Thu Apr 25, 2002 9:35 am    Post subject: Reply with quote

I have to agree. Colors should be default.
Back to top
View user's profile Send private message
dshepard@wvu.edu
Guest





PostPosted: Fri Apr 26, 2002 1:09 am    Post subject: If you really want this to work... Reply with quote

Add the following to your /etc/profile.env:

alias ls='ls --color=always -F -b -T 0'
export LS_COLORS='no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;
35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:*.tar=01;
31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;
31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jpg=01;
35:*.gif=01;35:*.bmp=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;
35:*.tif=01;35:*.png=01;35:*.mpg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;
35:*.dl=01;35::'


This does the job nicely. Adding those lines to ~/.bashrc causes the changes not to take effect at the shell prompt, unless you log into another bash shell inside the login shell. This will fix this problem. I'm not sure if this is the best place to do this. If anyone else has a better place to put such a thing, please let me know.
Back to top
dshepard@wvu.edu
Guest





PostPosted: Fri Apr 26, 2002 1:10 am    Post subject: Sorry... Reply with quote

If my last post made your browser window scroll left/right. I didn't realize the text wouldn't wrap...
Back to top
dshepard@wvu.edu
Guest





PostPosted: Fri Apr 26, 2002 1:15 am    Post subject: As you were... Reply with quote

Apparently this info is needed in two locations for consistency: .bashrc for Konsole and /etc/profile.env for the real console. Doesn't hurt to have it in two places I suppose. I couldn't get dircolors to work right on my gentoo system.
Back to top
Dunska
n00b
n00b


Joined: 27 Apr 2002
Posts: 15
Location: Brisbane, Australia

PostPosted: Sat Apr 27, 2002 10:28 am    Post subject: profile.env Reply with quote

I modified my /etc/profile.env but it always returns to a default state
(i.e. my mods gone) when I reboot.... is there some other file I need to
modify or some other way to make profile.env chnages stay?
Back to top
View user's profile Send private message
sven
Apprentice
Apprentice


Joined: 19 Apr 2002
Posts: 274

PostPosted: Sat Apr 27, 2002 10:33 am    Post subject: Reply with quote

I figured long before I found out how to also add colors to konsole, the KDE terminal program.
My alias settings (for ls) are stored in ~/.bash_profile but konsole never wanted to load this file ...
Well, you have to add the "--ls" option to konsole and it will load the files and --voila-- colors in konsole :D
Back to top
View user's profile Send private message
sven
Apprentice
Apprentice


Joined: 19 Apr 2002
Posts: 274

PostPosted: Sat Apr 27, 2002 10:36 am    Post subject: Reply with quote

@Dunksa Hmmm, this is strange! Better add your modifications to .bash_profile in your users home directory.
This is is a better (and cleaner) way of adding own aliases and settings.... but this is just my humble opinion :P
Back to top
View user's profile Send private message
Dunska
n00b
n00b


Joined: 27 Apr 2002
Posts: 15
Location: Brisbane, Australia

PostPosted: Sat Apr 27, 2002 11:39 am    Post subject: Reply with quote

I'll give it a shot - thanks.
Back to top
View user's profile Send private message
ElCondor
Guru
Guru


Joined: 10 Apr 2002
Posts: 520
Location: Vienna, Austria, Europe

PostPosted: Sat Apr 27, 2002 11:42 am    Post subject: Reply with quote

I did it with just two things, worked pretty fine:

1st generate a file /etc/DIR_COLORS
2nd add the following to your /etc/profile (for bash at least):
Code:

alias ls="ls --color"
eval `dircolors /etc/DIR_COLORS`

i defined every terminal (gnome-terminal, xterm, etc) as login-shell by default, so it sources /etc/profile.

email me for a structured and very colorfull dir-listing ;)

hth

ElCondor
Back to top
View user's profile Send private message
chadh
Moderator
Moderator


Joined: 21 Apr 2002
Posts: 137
Location: Atlanta, GA

PostPosted: Sat Apr 27, 2002 6:31 pm    Post subject: Re: profile.env Reply with quote

Dunska wrote:
I modified my /etc/profile.env but it always returns to a default state
(i.e. my mods gone) when I reboot.... is there some other file I need to
modify or some other way to make profile.env chnages stay?


Don't edit /etc/profile.env. It is automatically generated based on the contents of /etc/env.d . Either put system-wide settings there, or put them in your /etc/profile.
_________________
Chad
Back to top
View user's profile Send private message
daveman1010220
n00b
n00b


Joined: 26 Apr 2002
Posts: 3
Location: Pennsylvania

PostPosted: Sun Apr 28, 2002 1:57 am    Post subject: hmmm... Reply with quote

Didn't know the trick about launching konsole with -ls, however, it seems that konsole will read .bashrc all by itself. This is really unfortunate because bash (at the real console) reads .bash_profile all by itself. So as it ends up, you have to put settings in both files because konsole wants to be different. I personally don't see why Bash has a .bash_profile as well as a .bashrc, since both reside in the user's home directory. Oh well, have however you want it. By the way, if I have a setting I like, I generally make it system-wide, as other people will probably like them as well, but never actually take the time to set some decent defaults.(or even learn how...)
Back to top
View user's profile Send private message
chadh
Moderator
Moderator


Joined: 21 Apr 2002
Posts: 137
Location: Atlanta, GA

PostPosted: Sun Apr 28, 2002 3:15 am    Post subject: Reply with quote

The reason that konsole by default doesn't read your .bash_profile is because it does not start a login shell. Traditionally there had to be separate login and non-login modes b/c automated remote logins (things like rsh) did not handle output in the login process. I am used to having a login shell source both the profile and the rc file, so I normally just add "source ~/.bashrc" at the end of my .bash_profile.
_________________
Chad
Back to top
View user's profile Send private message
sven
Apprentice
Apprentice


Joined: 19 Apr 2002
Posts: 274

PostPosted: Sun Apr 28, 2002 11:19 am    Post subject: Reply with quote

Just noticed that .bash_profile points to a file named /etc/DIR_COLORS ...
Well, I must have accidently deleted this file or it was never installed because I don't have this file.
Which package contains this file?
Back to top
View user's profile Send private message
Jeevz
Bodhisattva
Bodhisattva


Joined: 15 Apr 2002
Posts: 195
Location: Boston, MA

PostPosted: Sun Apr 28, 2002 12:41 pm    Post subject: Reply with quote

You create it yourself. Check out the man page for dircolors.
Back to top
View user's profile Send private message
roTor
n00b
n00b


Joined: 21 Apr 2002
Posts: 55
Location: Atlanta, GA

PostPosted: Sun Apr 28, 2002 2:38 pm    Post subject: Reply with quote

OK, just to add to my confusion how do I get the colors to work when I use "less" to see a long dir listing?
Back to top
View user's profile Send private message
Nossie
Apprentice
Apprentice


Joined: 19 Apr 2002
Posts: 180

PostPosted: Fri May 10, 2002 4:44 pm    Post subject: Reply with quote

DIR_COLORS is part of the fileutils package.

You can find the file here :

Code:
/usr/portage/sys-apps/fileutils/files/DIR_COLORS


greets,
Nossie

P.S. The -ls switch also works for aterm
Back to top
View user's profile Send private message
leaf
n00b
n00b


Joined: 06 May 2002
Posts: 10
Location: England

PostPosted: Fri May 10, 2002 6:49 pm    Post subject: Reply with quote

roTor wrote:
OK, just to add to my confusion how do I get the colors to work when I use "less" to see a long dir listing?


I'd like to know the answer to that too.
Back to top
View user's profile Send private message
arkane
l33t
l33t


Joined: 30 Apr 2002
Posts: 918
Location: Phoenix, AZ

PostPosted: Fri May 10, 2002 7:32 pm    Post subject: Reply with quote

roTor wrote:
OK, just to add to my confusion how do I get the colors to work when I use "less" to see a long dir listing?


less has a -R command that will take ansi escape sequences.

so if your ls is colored (you can also use the --color for ls if it isn't) then you can use less -R to show color.

HTH
Back to top
View user's profile Send private message
mooteel
n00b
n00b


Joined: 18 Apr 2002
Posts: 8
Location: Montreal, QC

PostPosted: Fri May 10, 2002 7:33 pm    Post subject: Reply with quote

Maybe this will help a bit...

I personally add 'alias='ls -F --color' to my own user's .bashrc

Then I add the same thing to /etc/skel/.bashrc so that any newly created users get this change also by default. It won't change any existing users though. It would have to be done manually or with a script.

Of course, making those changes in /etc/profile or /etc/profile.env (not sure) would also work for a system wide use.

Good luck!
Back to top
View user's profile Send private message
cwsaylor
Guest





PostPosted: Thu May 23, 2002 6:03 pm    Post subject: Reply with quote

I know I'm a little late to this game but I thought I would throw this out for anybody searching on this topic.

All of the settings you need are found in /etc/skel. It contains a .bash_profile and .bashrc. These are not put into the /root folder by default but they are put into any new user's folder. Just copy them over to /root and you're done.

If you want these files to load from the gnome terminal panel icon, choose settings, preferences, Use --login by default.

I have a few aliases for emerge that are useful.
esearch="emerge search"
epretend="emerge --pretend"
eget="emerge --fetchonly"

I prefer to see what's going to be installed first, then get all of the files, then comile.

Enjoy
Chris
Back to top
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum