3

Is it possible to have colored output in adb shell, e.g. for the ls command?

I've tried ls --color=auto . etc, but that doesn't seem to work.

Colored output, however, works in adb shell, e.g. with

echo -e '\033[01;35m test \033[m'

Or does the ls command in adb not provide a "full feature" ls and it depends on the command?


Required Information:

  • Device: HTC Desire S S510e
  • Android: Gingerbread 2.3.5
2

Screenshot with colored LS output

As you can see from the screenshot, you can definitely get colored output in ls on android. (side note - I've got some bashrc magic running so the default ls output is ls --color=auto) Probably you're either running ls in a sh shell and not bash, you've got a watered-down OEM version of ls, or there's some strange magic happening between ADB on Windows and the linux terminal.

What device/android version/ROM are you running? What output does ls --version give?

  • ls --version does give me --version: No such file or directory. I have a non-rooted phone with Gingerbread 2.3.5 :). The device is a HTC Desire S S510e. I don't currently know how to find out the ROM - I guess I am using a stock ROM. – polym Aug 21 '14 at 18:16
  • Fascinating. So if I had to guess, HTC probably has a watered down version of ls in their stock firmware. If you want one with colored output and the like, you'll need to install Busybox. I believe you need root for it, but you might be able to get on without root... – sloosecannon Aug 21 '14 at 18:25
  • I guess that's a proper guess. Will try the busybox suggestion. Thanks. – polym Aug 21 '14 at 18:30
0

I just had to type shell after open the adb shell. I'm using LMDE Mate Desktop. Using the mate-terminal.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.