Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Location: Pouganis -- a planet not too far from over there.
Distribution: Vector
Posts: 31
Rep:
ls colors in xterm/rxvt/aterm
How do I get ls to always show colors in one of the terminals without always passing the --color arguement? I've already gone through DIR_COLORS and made sure each terminal I wanted was listed in the TERM area, and that the alias for ls had --color=always appended to it, but the terminals don't seem to want to use the alias. Colors work automatically in the terminal outside of X, but xterm, rxvt, and aterm don't want to do it. I've gone through the list of options for each for the last couple hours trying out different combinations to no avail.
You may find that aliasing ls to always use the -a switch to show all files, including system files (beginning with a dot) can be quite counter-productive. At least that's what I feel. When I list my home dir with the -a switch the output goes on for pages, while when I do a regular list I get my few neat folders.
I generally use alias ls='ls --color -F'. The -F switch enables extra visual features - directory names get a slash appended, executable files get an asterisk appended and symlinks get an @ character appended. It's quite usable, especially if you sometimes use terminal types that do not support color.
Well the problem with the -a script is, as has been said, you get quite a lot of output. For example, when you do that to your ~ dir, you see all sorts of files that right at that instance, you're not really interested in, such as .screenrc, .xinitrc, .vnc, .bashrc, .inputrc, ./, ../ and so on [of course, it does depend on what you've got installed and used]. Quite often, you have to pipe the ouput through less or some other useful program to actually see what you want. And, you can't un-a it, whereas if you need to, you can -a it.
I'm not sure if this will help, but there is a "system" default .bashrc located in the /etc/.profile directory. In there they setup default aliases for ls depending on which shell you invoke. This is executed after your local .bashrc file, so it will overwrite any setting you have in there.
Location: Pouganis -- a planet not too far from over there.
Distribution: Vector
Posts: 31
Original Poster
Rep:
Thanks everyone. With you guy's help I finally figured it out. I've been trying to add the alias to etc/profile (which should work from everything I've read), but it didn't. Everything I've read says you have either .bashrc or profile, and I had profile. But when I created .bashrc and added the alais there it worked. So, what's the difference between profile and .bashrc? The normal terminal took the alias in profile just fine, but xterm and rxvt would only take it from .bashrc. Weird. Thanks again everyone...YAY! COLORS!
you just have to do an "export" to tell bash where to read from:
export /etc/profile
export ~/.bashrc
etc.
you can even direct root to one version, and users to another version (or other versions) to get different effects depending on which user you are, or if you are root. i think that works as ~/.bashrc and /etc/profile, or what i do is just put a separate .bashrc in /root for root (and then "export /root/.bashrc" as root, of course).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.