Search code examples
unixls

Redirect to a result of /bin/ls


When I use ls . (/bin/ls) it returns a list of files.

when "." has directories and I try to redirect ls . by ls . > tmp.txt,

it contains many symbols like below

[1m[36m010202E[39;49m[0m
[1m[36m031403C[39;49m[0m

Directory names are 010202E and 031403C

this txt file can be read by "less" but not by vi or any other editors like text wrangler .

How can I avoid this problem? I know there is a way to delete those characters after making "tmp.txt".


Solution

  • It is likely that there's an alias that makes ls print the output with color. Try to use "ls --color=none", instead.