README.md
1 Android's shell and utilities
2 =============================
3
4 Since IceCreamSandwich Android has used
5 [mksh](https://www.mirbsd.org/mksh.htm) as its shell. Before then it used
6 [ash](https://en.wikipedia.org/wiki/Almquist_shell) (which actually
7 remained unused in the tree up to and including KitKat).
8
9 Initially Android had a very limited command-line provided by its own
10 "toolbox" binary. Since Marshmallow almost everything is supplied by
11 [toybox](http://landley.net/toybox/) instead.
12
13 We started moving a few of the more important tools to full
14 BSD implementations in JellyBean, and continued this work in
15 Lollipop. Lollipop was a major break with the past in many ways (LP64
16 support and the switch to ART both having lots of knock-on effects around
17 the system), so although this was the beginning of the end of toolbox it
18 (a) didn't stand out given all the other systems-level changes and (b)
19 in Marshmallow we changed direction and started the move to toybox.
20
21 Not everything is provided by toybox, though. We currently still use
22 the BSD dd and grep (because the toybox versions are still unfinished),
23 and for the bzip2 command-line tools we use the ones that are part of
24 the bzip2 distribution. The awk added in Android P is Brian Kernighan's
25 "one true" awk.
26
27 The lists below show what tools were provided and where they came from in
28 each release starting with Gingerbread. This doesn't tell the full story,
29 because the toolbox implementations did have bugs fixed and options added
30 over the years. Gingerbread's rm, for example, supported `-r`/`-R` but not
31 `-f`. But this gives you an idea of what was available in any given release,
32 and how usable it was likely to be.
33
34 Also note that in any given release `toybox` probably contains more
35 commands than there are symlinks for in `/system/bin`. You can get the
36 full list for a release by running `toybox` directly.
37
38
39 Android 2.3 (Gingerbread)
40 -------------------------
41
42 BSD: cat dd newfs\_msdos
43
44 toolbox: chmod chown cmp date df dmesg getevent getprop hd id ifconfig
45 iftop insmod ioctl ionice kill ln log ls lsmod lsof mkdir mount mv
46 nandread netstat notify printenv ps reboot renice rm rmdir rmmod route
47 schedtop sendevent setconsole setprop sleep smd start stop sync top
48 umount uptime vmstat watchprops wipe
49
50
51 Android 4.0 (IceCreamSandwich)
52 ------------------------------
53
54 BSD: cat dd newfs\_msdos
55
56 toolbox: chmod chown cmp date df dmesg getevent getprop hd id ifconfig
57 iftop insmod ioctl ionice kill ln log ls lsmod lsof mkdir mount mv
58 nandread netstat notify printenv ps reboot renice rm rmdir rmmod route
59 schedtop sendevent setconsole setprop sleep smd start stop sync top
60 touch umount uptime vmstat watchprops wipe
61
62
63 Android 4.1-4.3 (JellyBean)
64 ---------------------------
65
66 BSD: cat cp dd du grep newfs\_msdos
67
68 toolbox: chcon chmod chown clear cmp date df dmesg getenforce getevent
69 getprop getsebool hd id ifconfig iftop insmod ioctl ionice kill ln
70 load\_policy log ls lsmod lsof md5 mkdir mount mv nandread netstat notify
71 printenv ps reboot renice restorecon rm rmdir rmmod route runcon schedtop
72 sendevent setconsole setenforce setprop setsebool sleep smd start stop
73 sync top touch umount uptime vmstat watchprops wipe
74
75
76 Android 4.4 (KitKat)
77 --------------------
78
79 BSD: cat cp dd du grep newfs\_msdos
80
81 toolbox: chcon chmod chown clear cmp date df dmesg getenforce getevent
82 getprop getsebool hd id ifconfig iftop insmod ioctl ionice kill ln
83 load\_policy log ls lsmod lsof md5 mkdir mkswap mount mv nandread netstat
84 notify printenv ps readlink renice restorecon rm rmdir rmmod route runcon
85 schedtop sendevent setconsole setenforce setprop setsebool sleep smd start
86 stop swapoff swapon sync top touch umount uptime vmstat watchprops wipe
87
88
89 Android 5.0 (Lollipop)
90 ----------------------
91
92 BSD: cat chown cp dd du grep kill ln mv printenv rm rmdir sleep sync
93
94 toolbox: chcon chmod clear cmp date df dmesg getenforce getevent getprop
95 getsebool hd id ifconfig iftop insmod ioctl ionice load\_policy log ls
96 lsmod lsof md5 mkdir mknod mkswap mount nandread netstat newfs\_msdos
97 nohup notify ps readlink renice restorecon rmmod route runcon schedtop
98 sendevent setenforce setprop setsebool smd start stop swapoff swapon
99 top touch umount uptime vmstat watchprops wipe
100
101
102 Android 6.0 (Marshmallow)
103 -------------------------
104
105 BSD: dd du grep
106
107 toolbox: df getevent iftop ioctl ionice log ls lsof mount nandread
108 newfs\_msdos ps prlimit renice sendevent start stop top uptime watchprops
109
110 toybox: acpi basename blockdev bzcat cal cat chcon chgrp chmod chown
111 chroot cksum clear comm cmp cp cpio cut date dirname dmesg dos2unix echo
112 env expand expr fallocate false find free getenforce getprop groups
113 head hostname hwclock id ifconfig inotifyd insmod kill load\_policy ln
114 logname losetup lsmod lsusb md5sum mkdir mknod mkswap mktemp modinfo
115 more mountpoint mv netstat nice nl nohup od paste patch pgrep pidof
116 pkill pmap printenv printf pwd readlink realpath restorecon rm rmdir
117 rmmod route runcon sed seq setenforce setprop setsid sha1sum sleep sort
118 split stat strings swapoff swapon sync sysctl tac tail tar taskset tee
119 time timeout touch tr true truncate umount uname uniq unix2dos usleep
120 vmstat wc which whoami xargs yes
121
122
123 Android 7.0 (Nougat)
124 --------------------
125
126 BSD: dd grep
127
128 toolbox: getevent iftop ioctl log nandread newfs\_msdos ps prlimit
129 sendevent start stop top
130
131 toybox: acpi base64 basename blockdev bzcat cal cat chcon chgrp chmod
132 chown chroot cksum clear comm cmp cp cpio cut date df dirname dmesg
133 dos2unix du echo env expand expr fallocate false find flock free
134 getenforce getprop groups head hostname hwclock id ifconfig inotifyd
135 insmod ionice iorenice kill killall load\_policy ln logname losetup ls
136 lsmod lsof lsusb md5sum mkdir mknod mkswap mktemp modinfo more mount
137 mountpoint mv netstat nice nl nohup od paste patch pgrep pidof pkill
138 pmap printenv printf pwd readlink realpath renice restorecon rm rmdir
139 rmmod route runcon sed seq setenforce setprop setsid sha1sum sleep sort
140 split stat strings swapoff swapon sync sysctl tac tail tar taskset tee
141 time timeout touch tr true truncate tty ulimit umount uname uniq unix2dos
142 uptime usleep vmstat wc which whoami xargs xxd yes
143
144
145 Android 8.0 (Oreo)
146 ------------------
147
148 BSD: dd grep
149
150 bzip2: bzcat bzip2 bunzip2
151
152 toolbox: getevent newfs\_msdos
153
154 toybox: acpi base64 basename blockdev cal cat chcon chgrp chmod chown
155 chroot chrt cksum clear cmp comm cp cpio cut date df diff dirname dmesg
156 dos2unix du echo env expand expr fallocate false file find flock free
157 getenforce getprop groups gunzip gzip head hostname hwclock id ifconfig
158 inotifyd insmod ionice iorenice kill killall ln load\_policy log logname
159 losetup ls lsmod lsof lspci lsusb md5sum microcom mkdir mkfifo mknod
160 mkswap mktemp modinfo modprobe more mount mountpoint mv netstat nice
161 nl nohup od paste patch pgrep pidof pkill pmap printenv printf ps pwd
162 readlink realpath renice restorecon rm rmdir rmmod runcon sed sendevent
163 seq setenforce setprop setsid sha1sum sha224sum sha256sum sha384sum
164 sha512sum sleep sort split start stat stop strings swapoff swapon sync
165 sysctl tac tail tar taskset tee time timeout top touch tr true truncate
166 tty ulimit umount uname uniq unix2dos uptime usleep uudecode uuencode
167 vmstat wc which whoami xargs xxd yes zcat
168
169 Android P
170 ---------
171
172 BSD: dd grep
173
174 bzip2: bzcat bzip2 bunzip2
175
176 one-true-awk: awk
177
178 toolbox: getevent getprop newfs\_msdos
179
180 toybox: acpi base64 basename blockdev cal cat chcon chgrp chmod chown
181 chroot chrt cksum clear cmp comm cp cpio cut date df diff dirname dmesg
182 dos2unix du echo env expand expr fallocate false file find flock free
183 getenforce groups gunzip gzip head hostname hwclock id ifconfig inotifyd
184 insmod ionice iorenice kill killall ln load\_policy log logname losetup
185 ls lsmod lsof lspci lsusb md5sum microcom mkdir mkfifo mknod mkswap
186 mktemp modinfo modprobe more mount mountpoint mv netstat nice nl nohup
187 od paste patch pgrep pidof pkill pmap printenv printf ps pwd readlink
188 realpath renice restorecon rm rmdir rmmod runcon sed sendevent seq
189 setenforce setprop setsid sha1sum sha224sum sha256sum sha384sum
190 sha512sum sleep sort split start stat stop strings swapoff swapon sync
191 sysctl tac tail tar taskset tee time timeout top touch tr true truncate
192 tty ulimit umount uname uniq unix2dos uptime usleep uudecode uuencode
193 vmstat wc which whoami xargs xxd yes zcat
194