User root and colors of scripts

Discuss Applications
Post Reply
User avatar
Basher52
guru
guru
Posts: 912
Joined: Wed Oct 22, 2003 5:57 am
Location: .SE

User root and colors of scripts

Post by Basher52 » Fri Nov 19, 2010 10:08 am

When I'm using my normal user(not su) then I get colors of scripts and it all is easy to read, but when I go into root then all text is white.

This has been so for the last... well way back since Fedora Core and some version I think, maybe longer, I can't remember, maybe even always.

Is there a way to set the correct colors when using user root too?

User avatar
Void Main
Site Admin
Site Admin
Posts: 5712
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Fri Nov 19, 2010 3:22 pm

Hmmm, my ls as root in Fedora has color. Check your aliases by typing "alias" and see if you have this one:

alias ls='ls --color=auto'

That gets set in /etc/profile.d/colorls.sh on my systems.

User avatar
Basher52
guru
guru
Posts: 912
Joined: Wed Oct 22, 2003 5:57 am
Location: .SE

Post by Basher52 » Fri Nov 19, 2010 3:51 pm

oh, hehe forgot to say that it's VI that has the color problem :(
the 'ls' always show the files in white(on black background)

User avatar
Void Main
Site Admin
Site Admin
Posts: 5712
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Fri Nov 19, 2010 5:33 pm

Are you using "vim" or "vi" for your command? Add an alias to root "alias vi=vim" to root's .bashrc.

User avatar
Basher52
guru
guru
Posts: 912
Joined: Wed Oct 22, 2003 5:57 am
Location: .SE

Post by Basher52 » Fri Nov 19, 2010 5:50 pm

I start 'VI' with the letters 'vi'. Tried that using 'vim ' and all colors showed up :)
Gonna add that, but I sure as he** won't remember that later lol so don¨t nuke this place since this is my linuxpedia. lol

Why is there a diff. between VI and VIM in the first place?

User avatar
Void Main
Site Admin
Site Admin
Posts: 5712
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Fri Nov 19, 2010 6:06 pm

vim is an "IMproved" version of vi, hence colors and the like. vi is the "basic" editor that is found on every UNIX system and what you would be using in recovery mode. You'll notice that it is located in /bin where vim is located in /usr/bin (and is much larger). Typically it's a bare essential utility that would be available at the most basic stage of boot. If you had a separate filesystem for /usr and that filesystem had a problem mounting you would still have access to /bin/vi which would reside on the root file system. That's just a few of the things I can think of off the top of my head.

User avatar
Basher52
guru
guru
Posts: 912
Joined: Wed Oct 22, 2003 5:57 am
Location: .SE

Post by Basher52 » Fri Nov 19, 2010 6:26 pm

ok, got that and it seems smart enough :)
but why does the short 'vi' start a different program for a "normal" user
and "'root" starts another?

User avatar
Void Main
Site Admin
Site Admin
Posts: 5712
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Fri Nov 19, 2010 6:46 pm

Basher52 wrote:ok, got that and it seems smart enough :)
but why does the short 'vi' start a different program for a "normal" user
and "'root" starts another?
Type "alias" as your normal user and then type "alias" as root and you will have your answer. A user account is aliased to start vim instead of vi when you type "vi". root generally is limited to more generic commands as it is an administrative account. vim is more of a "user" program. Having said that I always add the alias vi=vim to root's .bashrc on my systems.

User avatar
Basher52
guru
guru
Posts: 912
Joined: Wed Oct 22, 2003 5:57 am
Location: .SE

Post by Basher52 » Fri Nov 19, 2010 6:51 pm

OK, got this too, thx :D

I'm gonna start using vim instead of vi, for both 'user' and 'root' just to get used to it :P

Post Reply