LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 05-12-2003, 05:45 PM   #1
itsjustme
Senior Member
 
Registered: Mar 2003
Location: Earth
Distribution: Slackware, Ubuntu, Smoothwall
Posts: 1,571

Rep: Reputation: 45
ls in color for user and su -, but not su


In the initial terminal after booting and before startx, as user and as 'su -', I see the blue directory entries and those light blue files with the ampersands on the end of them and the other white files. And in some directories I see the red files, which appear to be compressed files. And then there are the yellow files in /dev.

If I just do 'su', all the files and directories show up as white, no colors.

Just curious why that is.

Incidentally, this is part of my iniitial foray into slackware and I'm still fairly new to linux in general.
Also, is there a link to some document that describes the different colors used for listing files and directories, or is that just something that you figure out as you go?

Thanks....
 
Old 05-12-2003, 06:22 PM   #2
trn
Member
 
Registered: Feb 2003
Distribution: freebsd/gentoo
Posts: 68

Rep: Reputation: 15
its because when you initialy boot up or are a normal user then bash reads profile information from .bashrc or .profile in your home dir and there is probably an alias for ls with color but when you su bash reads the profile info from the /root directory. You can su -m to match profile or -l or somthing else like that to keep your user settings while su'ing.
 
Old 05-12-2003, 06:48 PM   #3
itsjustme
Senior Member
 
Registered: Mar 2003
Location: Earth
Distribution: Slackware, Ubuntu, Smoothwall
Posts: 1,571

Original Poster
Rep: Reputation: 45
Oh, ok, I had a similar situation with the PS1 environment variable the other day, but I just today reformatted and reinstalled slackware - because I didn't like the way I had it partitioned.
So, anyway, the initial install of Slackware 9.0 doesn't create any .bashrc files, or .bash_profile files, or .profile files. I will have to create these from scratch.

It does have an /etc/profile file.

So much to learn. Thanks for the input.
 
Old 05-12-2003, 09:13 PM   #4
itsjustme
Senior Member
 
Registered: Mar 2003
Location: Earth
Distribution: Slackware, Ubuntu, Smoothwall
Posts: 1,571

Original Poster
Rep: Reputation: 45
I just discovered:

eval 'dircolors -b'

in my /etc/profile file.

So, I should be able to put that in my newly created .bash_profile files along with PS1 prompt variable, and then, of course, anything else that comes along as I get the environments set up for su and the user(s).

man dircolors doesn't tell which colors are associated with which file types, but dircolors does apparently set the color.

And I realize that figuring out the colors is just a matter of paying attention.

regards...
 
Old 05-12-2003, 09:28 PM   #5
itsjustme
Senior Member
 
Registered: Mar 2003
Location: Earth
Distribution: Slackware, Ubuntu, Smoothwall
Posts: 1,571

Original Poster
Rep: Reputation: 45
d'oh!!

That eval 'dircolors -b' didn't work in the .bash_profile. The PS1 assignment did work.

I assume then that I can put some alias line in there, such as maybe, like kinda sorta -> 'alias ls=ls --color', or some such?

Oh, and this is now in xterm, in windowmaker, in slackware 9.0.

regards....

Edit: man, I guess I'm just having Monday evening brain farts. I bet the colors in xterm have nothing to do with .bash_profile, eh? Or, maybe it does. The PS1 thing works in there.


Last edited by itsjustme; 05-12-2003 at 09:37 PM.
 
Old 05-13-2003, 07:48 PM   #6
DaOne
Member
 
Registered: Jan 2003
Location: USA
Distribution: Slackware
Posts: 498

Rep: Reputation: 30
Quote:
'alias ls=ls --color'
Did you try this yet? I would think creating an alias like this should work. Although I don't know if it needs to be in bash_profile as opposed to creating it from the CL.
 
Old 05-13-2003, 07:52 PM   #7
itsjustme
Senior Member
 
Registered: Mar 2003
Location: Earth
Distribution: Slackware, Ubuntu, Smoothwall
Posts: 1,571

Original Poster
Rep: Reputation: 45
I am easily distracted by the WTF mystique of linux. This issue was part of a WTF stack from another WTF stack and I haven't tried the alias thing yet. I should get back to that tomorrow.

 
Old 05-14-2003, 02:13 PM   #8
webtoe
Member
 
Registered: Apr 2001
Location: Cambridge, England
Distribution: Slackware 10, Fedora Core 3, Mac OS X
Posts: 617

Rep: Reputation: 30
the alias thing will need some quote marks in me thinks.

Anyway, the whole colour thing is because of the following fact me thinks. Just using "su" will cause you to hold root priveledges BUT not have root's environment variables. If you login at the login prompt as root, or use su - , then you will have root's environment. This means that you will have the colour thing and certain paths will be there. I found this when I couldn't compile something which you had to be root for. I just su to become root, but this didn't work coz it could never find the right library locations etc. Logged in at the command prompt and tried it and it worked without a hitch.

There are so many nooks and crannies all over the place to explore. Collectively we must know most of them......

HTH and is right

Alex
 
Old 05-16-2003, 02:42 PM   #9
itsjustme
Senior Member
 
Registered: Mar 2003
Location: Earth
Distribution: Slackware, Ubuntu, Smoothwall
Posts: 1,571

Original Poster
Rep: Reputation: 45
ok, finally got around to it. Copied my .bashrc and .bash_profile from /home/username into /root and added:

alias ls="ls --color"

to the .bash_profile.

And, exited from su and the su'ed again, and there were the colors with ls.

Now, I'm not really sure why the colors in ls work for the user without this in the user's .bash_profile. I can only assume that is has something to do with the

eval 'dircolors -b'

in /etc/profile.

Is there another . (dot) file in the home directory that points to the /etc/profile file?

Thanks for all the replies.
 
  


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
Color Depth, True Color, How to pacranch Amigo 2 04-09-2005 05:16 AM
[COLOR=red]ENCORE WIRELESS PCI Card 802.11b [/COLOR] enrique145 Linux - Hardware 3 07-07-2004 02:31 PM
bsetroot -gradient texture -from color -to color patpawlowski Linux - General 3 02-10-2004 01:51 PM
user has color but superuser has only white - this should not be Bruce Hill Linux - Newbie 4 10-31-2003 07:55 PM
[COLOR=seagreen]HELP-want to use Kickstart/rh7.2 on a notebook[/COLOR] verbali Linux - Newbie 1 05-13-2002 01:59 PM


All times are GMT -5. The time now is 09:18 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration