elementary technical question
When I enter the command ls at a terminal window, some of the file names
are in various colors, even though I set the colors preferences to black
on white. Some jpg files are in magenta, and some in black print. What
sort of information is being transmitted by these colors?
Thanks
--
Dennis Tuchler
On 13 Apr 2003 11:55:21 -0500
Dennis Tuchler
When I enter the command ls at a terminal window, some of the file names are in various colors, even though I set the colors preferences to black on white. Some jpg files are in magenta, and some in black print. What sort of information is being transmitted by these colors?
Those are ansi escape sequences. Run this script. There is a man page for these codes, "man console_codes" #!/bin/sh echo "\e[1;31mHello world\e[0m\n" echo "\e[1;32mHello world\e[0m\n"; echo "\e[1;33mHello world\e[0m\n"; echo "\e[1;34mHello world\e[0m\n"; echo "\e[1;35mHello world\e[0m\n"; echo "\e[1;36Hello world\e[0m\n"; echo "\e[1;37mHello world\e[0m\n"; -- use Perl; #powerful programmable prestidigitation
On Sun, 13 Apr 2003 14:28:13 -0400
zentara
On 13 Apr 2003 11:55:21 -0500 Dennis Tuchler
wrote: When I enter the command ls at a terminal window, some of the file names are in various colors, even though I set the colors preferences to black on white. Some jpg files are in magenta, and some in black print. What sort of information is being transmitted by these colors?
Those are ansi escape sequences. Run this script. There is a man page for these codes, "man console_codes"
#!/bin/sh echo "\e[1;31mHello world\e[0m\n" echo "\e[1;32mHello world\e[0m\n"; echo "\e[1;33mHello world\e[0m\n"; echo "\e[1;34mHello world\e[0m\n"; echo "\e[1;35mHello world\e[0m\n"; echo "\e[1;36Hello world\e[0m\n"; echo "\e[1;37mHello world\e[0m\n";
Ooops...sorry, I'm better at Perl than shell. The above script dosn't display colors, but the one below will. #!/usr/bin/perl #perldoc -q color use strict; use warnings; print "\e[1;31mHello world\e[0m\n"; print "\e[1;32mHello world\e[0m\n"; print "\e[1;33mHello world\e[0m\n"; print "\e[1;34mHello world\e[0m\n"; print "\e[1;35mHello world\e[0m\n"; print "\e[1;36Hello world\e[0m\n"; print "\e[1;37mHello world\e[0m\n"; __END__ -- use Perl; #powerful programmable prestidigitation
On Sun, Apr 13, 2003 at 11:55:21AM -0500, dtuchler@earthlink.net wrote:
When I enter the command ls at a terminal window, some of the file names are in various colors, even though I set the colors preferences to black on white. Some jpg files are in magenta, and some in black print. What sort of information is being transmitted by these colors?
Depends on the value of your $LS_COLORS environment variable. It's often set up to indicate: o Permissions (read/write/execute) o File types (files vs directories vs symbolic links vs devices) o Filename extensions (.exe, .jpg, .txt, etc.) 'man ls' should tell you more. -- David Smith Work Email: Dave.Smith@st.com STMicroelectronics Home Email: David.Smith@ds-electronics.co.uk Bristol, England GPG Key: 0xF13192F2
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On April 13, 2003 12:55 pm, Dennis Tuchler wrote:
What sort of information is being transmitted by these colors?
Different file types. Charles - -- "Linux, because up-time matters gawk; talk; date; wine; grep; touch; unzip; touch; gasp; finger; gasp; mount;\ fsck; more; yes; gasp; umount; make clean; make mrproper; sleep." - --Drunken Bastard -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (GNU/Linux) iD8DBQE+ma+G3epPyyKbwPYRAlnYAKDEccvt3Xui8ir0tLdDpAdxV58FEQCfR+PZ VcyxusYxpPtpI6fvcQ5qIRE= =2I48 -----END PGP SIGNATURE-----
participants (4)
-
Charles Philip Chan
-
Dave Smith
-
Dennis Tuchler
-
zentara