Service Console Directory Listing Text Color in PuTTY

January 25th, 2010 by jason Leave a reply »

Curious about the default colors you see in a remote PuTTY session connected to the ESX Service Console?  Some are obvious such as the directory listings which show up as blue text on a black background.  Another obvious one is the compressed .tar.gz file which will show up in a nicely contrasting red text on black background.  Or how about this one which I’m sure you’ve seen, executable scripts are shown as green text on a black background.  You might be asking yourself “What about the oddball ones I see from time to time which don’t have an explanation?”  I’ve provided an example in the screenshot – a folder named isos shows up with a green background and blue text.  What does that mean? 

There’s a way to find out.  While in the remote PuTTY session connected to the ESX Service Console, run the command dircolors -p from any directory.  Here’s the default legend:

# Below are the color init strings for the basic file types. A color init
# string consists of one or more of the following numeric codes:
# Attribute codes:
# 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
# Text color codes:
# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
# Background color codes:
# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
NORMAL 00 # global default, although everything should be something.
FILE 00 # normal file
DIR 01;34 # directory
LINK 01;36 # symbolic link. (If you set this to ‘target’ instead of a
 # numerical value, the color is as for the file pointed to.)
FIFO 40;33 # pipe
SOCK 01;35 # socket
DOOR 01;35 # door
BLK 40;33;01 # block device driver
CHR 40;33;01 # character device driver
ORPHAN 40;31;01 # symlink to nonexistent file
SETUID 37;41 # file that is setuid (u+s)
SETGID 30;43 # file that is setgid (g+s)
STICKY_OTHER_WRITABLE 30;42 # dir that is sticky and other-writable (+t,o+w)
OTHER_WRITABLE 34;42 # dir that is other-writable (o+w) and not sticky
STICKY 37;44 # dir with the sticky bit set (+t) and not other-writable
# This is for files with execute permission:
EXEC 01;32
# List any file extensions like ‘.gz’ or ‘.tar’ that you would like ls
# to colorize below. Put the extension, a space, and the color init string.
# (and any comments you want to add after a ‘#’)
# If you use DOS-style suffixes, you may want to uncomment the following:
#.cmd 01;32 # executables (bright green)
#.exe 01;32
#.com 01;32
#.btm 01;32
#.bat 01;32
.tar 01;31 # archives or compressed (bright red)
.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
.jar 01;31
# image formats
.jpg 01;35
.jpeg 01;35
.gif 01;35
.bmp 01;35
.pbm 01;35
.pgm 01;35
.ppm 01;35
.tga 01;35
.xbm 01;35
.xpm 01;35
.tif 01;35
.tiff 01;35
.png 01;35
.mov 01;35
.mpg 01;35
.mpeg 01;35
.avi 01;35
.fli 01;35
.gl 01;35
.dl 01;35
.xcf 01;35
.xwd 01;35
# audio formats
.flac 01;35
.mp3 01;35
.mpc 01;35
.ogg 01;35
.wav 01;35

 

Applied to the screenshot example above, the legend tells us that the isos directory is: OTHER_WRITABLE 34;42 # dir that is other-writable (o+w) and not sticky.

Another color you may commonly see which I haven’t yet mentioned is cyan which identifies symbolic links.  These can be found in several directories.  Most often you will see symbolic links in /vmfs/volumes/ connecting a friendly datastore name with it’s not so friendly volume name which is better known by the VMkernel.

That’s it. Not what I would considering Earth shattering material here, but maybe you’ve seen these colors before and haven’t connected the dots on their meaning.  For people with Linux background, this is probably old hat.

Advertisement

5 comments

  1. Mr. Hmmmm says:

    This post kind of makes me cringe due to the explicit reference of this being something you can do “in Putty.” Not in an ssh session, which would be more descriptive, or on the Linux command line in general (which the Service Console implements), which would be more accurate, but “in Putty.” I’m no rabid foaming at the mouth Linux fanboi, but the wording used in this post is suggestive of, if not a total ignorance of Linux and UNIX platforms, a relative ignorance towards their fundamental underpinnings.

  2. jason says:

    I’m no Linux or Unix expert, nor do I claim to be. I was born and raised on Commodore, MS-DOS, and then Windows. I more or less skipped Linux (and Mac) and only used it when there was a business requirement to do so later in my career. Thank you for your observation.

  3. I agree with Mr Hmmmm, and Jason I think you should rename this blog from “boche.net – VMware Virtualization Evangelist” to “botched.net – Virtual Stupid Head” because you are clearly ignorant to what the significance of what Mr Hmmmm was declaring.

    Reading between the lines, because clearly and obviously you’d be unable to,

    The reason that some of the text is ‘blue’ and some of the text is ‘red’ is because red files are EVIL!!!! Why would you even have those files on your system? OMG R U TEH DEVIL?!? Seriously Jason, wake up and smell the mocha chai latte grande with half soy, half powdered creamer, and half water YEA BAIBEE i DID SAY 3 HALVES! because Three halves makes EVIL RED FILES.

    So, I want you to march out and delete those dark vile files from your system, and who knows… maybe if you’re a good boy, all of your files will turn into PRETTY GREEN BACKGROUND FILES

    Alright, now that my tirade is over:

    Wow, nice tutorial explaining something which for the most part may be overlooked by others and often not documented. Hey Mr Hmmmm, this post is clearly not for you, because you GET it, it’s for the people who wake up each day and go WTF WHY R MY FILES RED?! HELP! and they go calling the geek squad who formats their machine and loads XP.

    So, keep up the good work Jason, and get some visine in your system.

    (Visine: The old beta name for the Netware to Microsoft migration tool ;))

  4. talon says:

    Good tutorial, I am just a beginner and was wondering how to find the colors and what they mean. Thanks and don’t let the douches get you down lol.

  5. paul says:

    thanks, i was looking for exactly this information. it took me a while to find it (well about 20 mins googling), but imagine this…i’m pretty new to linux and manage my box using Putty! from a windows box! and i was wondering exactly what the green highlighted directory meant! so this was extremely informative for me. now i’m left with the question, and next google search, do i need to change permissions on that dir/file…

Leave a Reply