I have noticed that if I run '/bin/ls --color=always --file-type -aFC' on my network drive, that it takes anywhere from 39s to 57s to complete. I assumed the problem was just the colorizing. If I run '/bin/ls --color=never --file-type -aC', the command takes less than 2s. The same, if I run the same command and pipe it to sed to add some pretty colors. However, if I create a shell function that runs the same ls command to sed, it now takes close to a minute. It's the same if I make a shell script to pipe ls to sed. It runs great on the command line, however. I also notice that if I run '/bin/ls --color=never --file-type -aC *.ps1', it takes over a minute.
I read somewhere that exa was a faster, more powerful ls, but it also takes close to a minute to run. Why is a bare ls so fast and an ls with arguments so slow? Is there anything that I can do to speed things up? Is there any way to keep the speed of a bare ls command while still being able to pipe the output to sed?
I'm running ksh93 version 1.0.6 on Ubuntu running under WSL. Thanks!
Some examples:
Command line:
--> time /bin/ls --color=never --file-type -C | sed -E $'s/([[:graph:]]+ ?)+\\//\e[01m\e[34m&\e[0m\e[37m/g'
real 0m00.43s
user 0m00.00s
sys 0m00.00s
shell script:
#!/bin/ksh -p
/bin/ls --color=never --file-type -aFC | sed -E $'s/([[:graph:]]+ ?)+\\//\e[01m\e[34m&\e[0m\e[37m/g'
--> cat ~/bin/colorls
/s/wastebasket/sam $ time ~/bin/colorls
real 1m12.73s
user 0m00.00s
sys 0m00.04s