Originally Posted by babu198649
no change had took place . can u explain what is the function of the code.
The very oldest type of terminals which were used with unix-like OSes were in fact teletype terminals which used a printer as a display. The output was literally printed out. The printers had pretty limited functionality, but it was possible to achieve special printing styles using simple methods. For example, to print in bold, the teletypes would print over the same letters more than once. This would be accomplished by sending a letter, a backspace and the letter again. The over-printing which resulted gave the effect of bold type.
Even through the teletypes were replaced with terminals with video displays, this method of sending special formatting information to the terminal persisted. New terminals added new control codes for doing things like using a larger font, moving the cursor around the screen and so on.
As new features were added to terminals it became possible to write terminal applications which would provide pseudo GUI-like features, but all drawn in a text terminal. For example the full-screen editors nano and vi, or emacs's text mode. Also mail clients like elm and pine. To avoid the programmer having to cater for many different terminal types with different capabilities, libraries which can be used to make these apps (most famously curses and the modern version, ncurses) hide the details from the programmer.
The curses programs (and other programs which use special terminal control codes) know which codes to send based on the TERM environment variable. This should identify the type of terminal which is in use, and is used to look up the terminal's capabilities in the termcap database when one of these libraries is used to draw some part of an applications interface.
Colours, like other terminal capabilities are sent using special control sequences which are "printed" to the terminal before the text which is to be printed in the chosen colour. If the codes do not match the capability of the terminal it might
result in the first character of the coloured word not printing - the symptom you described. The command I gave you removes printing of colours by ls. If this worked then we would have taken a look at the TERM and the LS_COLORS values to see if we colulf fix it. But it was not your problem.