Sponsored Content
Full Discussion: ls color on AIX
Operating Systems AIX ls color on AIX Post 302276717 by bakunin on Wednesday 14th of January 2009 12:40:12 PM
Old 01-14-2009
Quote:
Originally Posted by tagger
It doesnt work very well with | more.
Do U know why ?
more - as well as pg - act both as text filters. Both are intended to be fed pure text streams and everything else (that includes termcap sequences or ANSI sequences) is not guaranteed to work at all.

That was the short answer. The same effect, for example you will see when feeding a non-english text with umlauts or other diacritical extravaganza to "more" and/or "pg". Some - more by chance than intendedly so - works, most do not.

The reason for your problem is that the colours in "ls" come from injections of terminal steering sequences into the stream of characters and whitespace. Here is the principle:

Code:
without LS_COLOURS
# ls -lrt
total 128
54198505 drwxr-xr-x  3 user user  4096 Jan  6 18:06 .
54165666 drwxr-xr-x 17 user user  4096 Jan  6 18:06 ..
54198511 -rw-------  1 user user  1066 Jan  6 18:06 file1
54198519 -rw-------  1 user user 21451 Jan  6 18:06 file2
54198519 drw-------  1 user user 21451 Jan  6 18:07 dir1

with LS_COLOURS
# ls -lrt
total 128
54198505 drwxr-xr-x  3 user user  4096 Jan  6 18:06 <ESC-Seq>.<ESC-Seq>
54165666 drwxr-xr-x 17 user user  4096 Jan  6 18:06 <ESC-Seq>..<ESC-Seq>
54198511 -rw-------  1 user user  1066 Jan  6 18:06 <ESC-Seq>file1<ESC-Seq>
54198519 -rw-------  1 user user 21451 Jan  6 18:06 <ESC-Seq>file2<ESC-Seq>
54198519 drw-------  1 user user 21451 Jan  6 18:07 <ESC-Seq>dir1<ESC-Seq>

These ESC-Sequences set the terminal to display the characters in different colours or reset this mode back to normal. Read a man page of termcap and search for "standout modes" if you want to know more.

There are two possible explanations for your problem: the first one is, that "ls" behaves differently if writing to a terminal or a pipeline. For instance, if you issue "ls" (without parameter) the output will be in several columns. If you issue "ls | pg" you will notice that it is formatted not in several but only one column. "ls" is designed that way because it makes writing scripts easier (if you have to split the columns back to single files first it would be more complicated to cycle through files in a loop), see "man ls" for details on this. Maybe it is the same with the colours and they are suppressed if ls notices that it is run in a pipeline to not interfere with scripting.

The other possible explanation is, that more eats away on the ESC-sequences because it doesn't know hoe to deal with them for reasons described above. Try using "less" as a "more"-replacement in this case, because i suppose it will - coming from the same source, so to say - be able to deal with the formatting sequences better.

I hope this helps.

bakunin

PS for Padov: "more" can scroll forward and backwards too, at least in its AIX version: use the navigating keys known from vi, like:

"k" = line up
"j" = line down

etc.
 

3 More Discussions You Might Find Interesting

1. AIX

Configuring Color Laser ptr in AIX

Hi All, I have Network color laser printer which is to be configured in AIX5L. The Model of the printer is OKI C3200. Will it is supported with AIX 5..? I could not find any drivers for this. Will any compatible drivers are available for this printer... I tried with the default drivers hplj-4... (2 Replies)
Discussion started by: helloajith
2 Replies

2. UNIX for Dummies Questions & Answers

How to change the background color in the init 3 mode(not line color)

Hello, I am using RHEL 6.1 on VMware I am searching for a way to change background color (not line by line color wich one can using tput command) basically changing the color of the whole screen to white instead of the default black and changing font color to black and alos would like to... (2 Replies)
Discussion started by: Dexobox
2 Replies

3. AIX

How to print color text in AIX?

Hi I'd like to print color text and I've tried this: echo "\033but it didn't woked. When I changed 0 --> 1/4/5, the text "HI" --> bold/underline/blink, but when I changed 31 or 33 to other values, the color didn't change. What's the problem. Need to install something ??? (8 Replies)
Discussion started by: bobochacha29
8 Replies
SHADOW(5)							File Formats Manual							 SHADOW(5)

NAME
shadow - encrypted password file DESCRIPTION
shadow contains the encrypted password information for user's accounts and optional the password aging information. Included is Login name Encrypted password Days since Jan 1, 1970 that password was last changed Days before password may be changed Days after which password must be changed Days before password is to expire that user is warned Days after password expires that account is disabled Days since Jan 1, 1970 that account is disabled A reserved field The password field must be filled. The encryped password consists of 13 to 24 characters from the 64 characters alphabet a thru z, A thru Z, 0 thru 9, . and /. Optionally it can start with a "$" character. This means the encrypted password was generated using another (not DES) algorithm. For example if it starts with "$1$" it means the MD5-based algorithm was used. Refer to crypt(3) for details on how this string is interpreted. The date of the last password change is given as the number of days since Jan 1, 1970. The password may not be changed again until the proper number of days have passed, and must be changed after the maximum number of days. If the minimum number of days required is greater than the maximum number of day allowed, this password may not be changed by the user. An account is considered to be inactive and is disabled if the password is not changed within the specified number of days after the pass- word expires. An account will also be disabled on the specified day regardless of other password expiration information. This information supercedes any password or password age information present in /etc/passwd. This file must not be readable by regular users if password security is to be maintained. FILES
/etc/passwd - user account information /etc/shadow - encrypted user passwords SEE ALSO
chage(1), login(1), passwd(1), su(1), passwd(5), pwconv(8), pwunconv(8), sulogin(8) AUTHOR
Julianne Frances Haugh (jockgrrl@ix.netcom.com) SHADOW(5)
All times are GMT -4. The time now is 05:48 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy