ls > temp has extra characters
I have a series of log files I'd like to scroll through all at once instead of catting or lessing each one. So I'm thinking:
ls -1tc |xargs -l1 cat |less This gives a bunch of errors like foo.file not found. So I tried to simplify. (I know logging in as root is generally a Bad Thing.) Code:
[root@localhost log]# ls -1tc |tee temp I'm also confused about why the temp file that is just being created shows up during the ls command. The linux box is RHEL 5.1, but I'm using Putty to ssh in. Putty with XMing is pretty dang useful! |
The extra characters are ANSI escape sequences for colors. Perhaps you have an alias for ls to “ls --color=always”. Try removing this (or setting it to “ls --color=auto”).
|
I think they're colour codes; you might find that your ls command is actually aliased to ls --color (check with "alias" or "type ls"). To remedy it, try this:
Code:
\ls -1tc |tee temp Code:
/usr/bin/ls -1tc |tee temp |
Yep, ls was aliased to color=always. Now I know why auto is recommended! Thanks guys.
|
All times are GMT -5. The time now is 07:58 AM. |