Thursday, August 20, 2015

adb - Why do Linux commands not work properly on Android?


> adb shell
sh-4.1$ ls -F
-F: No such file or directory

-F switch works fine on my Ubuntu.


Why doesn't it work on Android? Is there a way to make it work?



Answer



Most shell commands in Android are not GNU versions or a POSIX-compliant implementation, they are either from Toolbox or Busybox and mostly stripped down versions.


A lot of commands in /system/bin are symlinks to /system/toolbox. I haven't found much documentation about it, just the source at https://android.googlesource.com/platform/system/core/+/jb-mr1-release/toolbox/



Busybox is another implementation of several common shell commands, with more commands and features than the default Toolbox. It's used on other embedded systems too, and some bootable GNU/Linux CDs, so you may already be familiar with it. Because it's open-source, there are several installers available on Google Play: just search for "Busybox".


No comments:

Post a Comment

samsung galaxy s 2 - Cannot restore Kies backup after firmware upgrade

I backed up my Samsung Galaxy S2 on Kies before updating to Ice Cream Sandwich. After the upgrade I tried to restore, but the restore fails ...