Why ls in adb shell doesn't sort by name?

Here is what I am getting in adb shell:

AccuWeather apkfiles.com.apk.tar    
Amazon Shopping apkfiles.com.apk.tar    
GO Weather EX V5 apkfiles.com.apk.tar   
Hulu V2 19 2 apkfiles.com.apk.tar   
Letgo V1 2 apkfiles.com.apk.tar 
Netflix apkfiles.com.apk.tar    

and where is what I am getting on Ubuntu desktop:

AccuWeather apkfiles.com.apk.tar
Amazon Shopping apkfiles.com.apk.tar
  • They are both sorted.. I think the first command sorts upper case first, and then lower case filenames. Did you shorten the command output?
    – Thomas Vos
    Commented Jun 18, 2016 at 18:54
  • Yes.. I have like 145 files in that directory. I see... It's probably the case. Why default sort behavior is different? Commented Jun 19, 2016 at 20:16

1 Answer 1


The ls command you run in the adb shell is provided by the Busybox (or Toybox) package on the device. The ls command you run on your Ubuntu machine is provided by Ubuntu Linux. They are not the same program, so they can have different behaviour.

The on-device commands are designed to be useful while taking up as little of the device storage as practical, because they're on every device, but the vast majority of Android users never know of them, let alone use them. The Linux commands are intended for people who use the Linux command line, which is a high percentage of Linux users. It's far more acceptable for them to have a wide range of options and take up disk space.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .