LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Linux CLI through Putty, do colors signify anything? (https://www.linuxquestions.org/questions/linux-newbie-8/linux-cli-through-putty-do-colors-signify-anything-782206/)

anon091 01-14-2010 10:57 AM

Linux CLI through Putty, do colors signify anything?
 
When I connect to a RHEL CLI via Putty, some folders are blue, some are highlighted green, etc etc.

Does all that signify something? Is there a link to a site that tells me what it all means?

Web31337 01-14-2010 11:13 AM

usually, blue are dirs, green are executables, red are archives, ltblue are symlinks, yellow are devices, etc, etc. basically it depends on color setup on linux box.

irmin 01-14-2010 11:14 AM

You mean that you login via Putty and enter e.g. ls to view the contents of the current directory?
ls can view different file types with different colors. (look at the LS_COLORS environment variable to get the meaning of them, since you can configure them as you want).

Enter "echo $LS_COLORS" and entries like "*.gz=0;31" tell you that file names ending with .gz should be viewed green with black background.

anon091 01-14-2010 11:14 AM

ok, thanks. Looks like some of my directories are blue, some are blue text but highlighted green for some reason.

anon091 01-14-2010 11:17 AM

Quote:

Originally Posted by irmin (Post 3826497)
You mean that you login via Putty and enter e.g. ls to view the contents of the current directory?
ls can view different file types with different colors. (look at the LS_COLORS environment variable to get the meaning of them, since you can configure them as you want).

Enter "echo $LS_COLORS" and entries like "*.gz=0;31" tell you that file names ending with .gz should be viewed green with black background.

yes, when I do a ls -l that's where I'm seeing the different coloring styles.

here's what my echo shows me, but how do I know what the numbers signify? like what color is what number, and is the first number background and the second text color?

no=00:fi=00:di=00;34:ln=00;36:pi=40;33:so=00;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;4 1:ex=00;32:*.cmd=00;32:*.exe=00;32:*.com=00;32:*.btm=00;32:*.bat=00;32:*.sh=00;32:*.csh=00;32:*.tar= 00;31:*.tgz=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.zip=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.b z2=00;31:*.bz=00;31:*.tz=00;31:*.rpm=00;31:*.cpio=00;31:*.jpg=00;35:*.gif=00;35:*.bmp=00;35:*.xbm=00 ;35:*.xpm=00;35:*.png=00;35:*.tif=00;35:

irmin 01-14-2010 11:45 AM

The values are "Select Graphics Rendition" numbers. You can find their meaning at
http://en.wikipedia.org/wiki/ANSI_escape_code
search for SGR.

Example:
*.sh=00;32 means files matching *.sh will select the following attributes: reset all then select green as the foreground color

e.g.: view png-files as yellow on blue background underlined: *.png=00;04;44;33
special names:
no - nothing
fi - file
di - directory
ln - symbolic link
pi - pipe
so - socket
do - ?
bd - block device
cd - character device
or - invalid file
su - setuid file
sg - setgid file
tw - sticky (writable)
ow - writeable by others (directory)
st - sticky (not writable)
ex - executable

anon091 01-14-2010 12:00 PM

Cool, thanks for all the info, i'll check it out!

anon091 01-14-2010 12:03 PM

I looked, but I still dont understand why some of my directories are just blue text, but some are blue text and highlighted green. does it have something to do with the permissions on the folder? like if its 770 its just blue text, if 777 blue text with green highlight?

irmin 01-14-2010 12:13 PM

Indeed the color has something to do with the permissions. If a directory has permission 777 it is writable by everybody. Thus it falls into category ow. Thus the rules
ow and di are applied.

anon091 01-14-2010 12:49 PM

Oh ok. I didn't see an ow in my echo output, so that must just be a default thing. I think I get it now!


All times are GMT -5. The time now is 10:34 PM.