On older Android versions
On older Android versions, shell commands tend to be either:
- Rewritten specifically for Android, and shipped as part of Toolbox. I'm not sure whether or not Toolbox is really documented anywhere.
- Or copied from NetBSD. If so, then the command was recompiled for Android, and the command (but not its manual page) is shipped with Android.
type to tell you where a command is stored, and
ls -l on the command to tell you whether it's a real binary or a symbolic link. If it's a symbolic link to Toolbox, then you'll know that the command is part of Toolbox.
A few commands, such as
kill, are available both as a shell builtin (this is the version which will normally run) and in
/system/bin (this version will normally never be run).
type will tell you which version will run.
On Marshmallow and up
Android 6.0 "Marshmallow" and up ship with Toybox, and most of the most commonly used shell commands (
ls, et cetera) tend to be Toybox toys. Toybox toys normally include built-in help; official manual pages are not included.
Still, Toybox doesn't include everything, and so not everything is provided by Toybox. For example, even on Android 6.0 "Marshmallow",
fsck_msdos (which should only be used to check SD cards of 32 GB or less) appears to be taken from either FreeBSD or NetBSD.
fsck_exfat (which can check most SD cards 64 GB or larger) is taken from elsewhere. I'm not sure where.
On modern versions of Android, the shell is
mksh, the MirBSD Korn shell. If
mksh is running, then to find out your
mksh version, enter: