README.md
1# Android's shell and utilities
2
3Since IceCreamSandwich Android has used
4[mksh](https://www.mirbsd.org/mksh.htm) as its shell. Before then it used
5[ash](https://en.wikipedia.org/wiki/Almquist_shell) (which actually
6remained unused in the tree up to and including KitKat).
7
8Initially Android had a very limited command-line provided by its own
9"toolbox" binary. Since Marshmallow almost everything is supplied by
10[toybox](http://landley.net/toybox/) instead.
11
12We started moving a few of the more important tools to full
13BSD implementations in JellyBean, and continued this work in
14Lollipop. Lollipop was a major break with the past in many ways (LP64
15support and the switch to ART both having lots of knock-on effects around
16the system), so although this was the beginning of the end of toolbox it
17(a) didn't stand out given all the other systems-level changes and (b)
18in Marshmallow we changed direction and started the move to toybox.
19
20Not everything is provided by toybox, though. For the bzip2 command-line tools
21we use the ones that are part of the bzip2 distribution. The awk added in
22Android P is Brian Kernighan's "one true" awk.
23
24The lists below show what tools were provided and where they came from in
25each release starting with Gingerbread. This doesn't tell the full story,
26because the toolbox implementations did have bugs fixed and options added
27over the years. Gingerbread's rm, for example, supported `-r`/`-R` but not
28`-f`. But this gives you an idea of what was available in any given release,
29and how usable it was likely to be. (**Bold** marks where we switched to toybox
30or first added something to toybox.)
31
32Also note that in any given release `toybox` probably contains more
33commands than there are symlinks for in `/system/bin`. You can get the
34full list for a release by running `toybox` directly.
35
36
37## Android 2.3 (Gingerbread)
38
39BSD: cat dd newfs\_msdos
40
41toolbox: chmod chown cmp date df dmesg getevent getprop hd id ifconfig
42iftop insmod ioctl ionice kill ln log ls lsmod lsof mkdir mount mv
43nandread netstat notify printenv ps reboot renice rm rmdir rmmod route
44schedtop sendevent setconsole setprop sleep smd start stop sync top
45umount uptime vmstat watchprops wipe
46
47
48## Android 4.0 (IceCreamSandwich)
49
50BSD: cat dd newfs\_msdos
51
52toolbox: chmod chown cmp date df dmesg getevent getprop hd id ifconfig
53iftop insmod ioctl ionice kill ln log ls lsmod lsof mkdir mount mv
54nandread netstat notify printenv ps reboot renice rm rmdir rmmod route
55schedtop sendevent setconsole setprop sleep smd start stop sync top
56touch umount uptime vmstat watchprops wipe
57
58
59## Android 4.1-4.3 (JellyBean)
60
61BSD: cat cp dd du grep newfs\_msdos
62
63toolbox: chcon chmod chown clear cmp date df dmesg getenforce getevent
64getprop getsebool hd id ifconfig iftop insmod ioctl ionice kill ln
65load\_policy log ls lsmod lsof md5 mkdir mount mv nandread netstat notify
66printenv ps reboot renice restorecon rm rmdir rmmod route runcon schedtop
67sendevent setconsole setenforce setprop setsebool sleep smd start stop
68sync top touch umount uptime vmstat watchprops wipe
69
70
71## Android 4.4 (KitKat)
72
73BSD: cat cp dd du grep newfs\_msdos
74
75toolbox: chcon chmod chown clear cmp date df dmesg getenforce getevent
76getprop getsebool hd id ifconfig iftop insmod ioctl ionice kill ln
77load\_policy log ls lsmod lsof md5 mkdir mkswap mount mv nandread netstat
78notify printenv ps readlink renice restorecon rm rmdir rmmod route runcon
79schedtop sendevent setconsole setenforce setprop setsebool sleep smd start
80stop swapoff swapon sync top touch umount uptime vmstat watchprops wipe
81
82
83## Android 5.0 (Lollipop)
84
85BSD: cat chown cp dd du grep kill ln mv printenv rm rmdir sleep sync
86
87toolbox: chcon chmod clear cmp date df dmesg getenforce getevent getprop
88getsebool hd id ifconfig iftop insmod ioctl ionice load\_policy log ls
89lsmod lsof md5 mkdir mknod mkswap mount nandread netstat newfs\_msdos
90nohup notify ps readlink renice restorecon rmmod route runcon schedtop
91sendevent setenforce setprop setsebool smd start stop swapoff swapon
92top touch umount uptime vmstat watchprops wipe
93
94
95## Android 6.0 (Marshmallow)
96
97BSD: dd du grep
98
99toolbox: df getevent iftop ioctl ionice log ls lsof mount nandread
100newfs\_msdos ps prlimit renice sendevent start stop top uptime watchprops
101
102toybox (0.5.2-ish): acpi basename blockdev bzcat cal cat chcon chgrp chmod chown
103chroot cksum clear comm cmp cp cpio cut date dirname dmesg dos2unix echo
104env expand expr fallocate false find free getenforce getprop groups
105head hostname hwclock id ifconfig inotifyd insmod kill load\_policy ln
106logname losetup lsmod lsusb md5sum mkdir mknod mkswap mktemp modinfo
107more mountpoint mv netstat nice nl nohup od paste patch pgrep pidof
108pkill pmap printenv printf pwd readlink realpath restorecon rm rmdir
109rmmod route runcon sed seq setenforce setprop setsid sha1sum sleep sort
110split stat strings swapoff swapon sync sysctl tac tail tar taskset tee
111time timeout touch tr true truncate umount uname uniq unix2dos usleep
112vmstat wc which whoami xargs yes
113
114
115## Android 7.0 (Nougat)
116
117BSD: dd grep
118
119toolbox: getevent iftop ioctl log nandread newfs\_msdos ps prlimit
120sendevent start stop top
121
122toybox (0.7.0-ish): acpi **base64** basename blockdev bzcat cal cat chcon chgrp chmod
123chown chroot cksum clear comm cmp cp cpio cut date **df** dirname dmesg
124dos2unix **du** echo env expand expr fallocate false find **flock** free
125getenforce getprop groups head hostname hwclock id ifconfig inotifyd
126insmod **ionice** **iorenice** kill **killall** load\_policy ln logname losetup **ls**
127lsmod **lsof** lsusb md5sum mkdir mknod mkswap mktemp modinfo more *mount*
128mountpoint mv netstat nice nl nohup od paste patch pgrep pidof pkill
129pmap printenv printf pwd readlink realpath **renice** restorecon rm rmdir
130rmmod route runcon sed seq setenforce setprop setsid sha1sum sleep sort
131split stat strings swapoff swapon sync sysctl tac tail tar taskset tee
132time timeout touch tr true truncate **tty** **ulimit** umount uname uniq unix2dos
133**uptime** usleep vmstat wc which whoami xargs **xxd** yes
134
135
136## Android 8.0 (Oreo)
137
138BSD: dd grep
139
140bzip2: bzcat bzip2 bunzip2
141
142toolbox: getevent newfs\_msdos
143
144toybox (0.7.3-ish): acpi base64 basename blockdev cal cat chcon chgrp chmod chown
145chroot chrt cksum clear cmp comm cp cpio cut date df **diff** dirname dmesg
146dos2unix du echo env expand expr fallocate false **file** find flock free
147getenforce getprop groups **gunzip** **gzip** head hostname hwclock id ifconfig
148inotifyd insmod ionice iorenice kill killall ln load\_policy **log** logname
149losetup ls lsmod lsof **lspci** lsusb md5sum **microcom** mkdir **mkfifo** mknod
150mkswap mktemp modinfo **modprobe** more mount mountpoint mv netstat nice
151nl nohup od paste patch pgrep pidof pkill pmap printenv printf **ps** pwd
152readlink realpath renice restorecon rm rmdir rmmod runcon sed **sendevent**
153seq setenforce setprop setsid sha1sum **sha224sum** **sha256sum** **sha384sum**
154**sha512sum** sleep sort split start stat stop strings swapoff swapon sync
155sysctl tac tail tar taskset tee time timeout **top** touch tr true truncate
156tty ulimit umount uname uniq unix2dos uptime usleep **uudecode** **uuencode**
157vmstat wc which whoami xargs xxd yes **zcat**
158
159
160## Android 9.0 (Pie)
161
162BSD: dd grep
163
164bzip2: bzcat bzip2 bunzip2
165
166one-true-awk: awk
167
168toolbox: getevent getprop newfs\_msdos
169
170toybox (0.7.6-ish): acpi base64 basename blockdev cal cat chcon chgrp chmod chown
171chroot chrt cksum clear cmp comm cp cpio cut date df diff dirname dmesg
172dos2unix du echo env expand expr fallocate false file find flock **fmt** free
173getenforce groups gunzip gzip head hostname hwclock id ifconfig inotifyd
174insmod ionice iorenice kill killall ln load\_policy log logname losetup ls
175lsmod lsof lspci lsusb md5sum microcom mkdir mkfifo mknod mkswap mktemp
176modinfo modprobe more mount mountpoint mv netstat nice nl nohup od paste
177patch pgrep pidof pkill pmap printenv printf ps pwd readlink realpath
178renice restorecon rm rmdir rmmod runcon sed sendevent seq setenforce
179setprop setsid sha1sum sha224sum sha256sum sha384sum sha512sum sleep
180sort split start stat stop strings **stty** swapoff swapon sync sysctl tac
181tail tar taskset tee time timeout top touch tr true truncate tty ulimit
182umount uname uniq unix2dos uptime usleep uudecode uuencode vmstat wc
183which whoami xargs xxd yes zcat
184
185
186## Android 10 ("Q")
187
188BSD: grep fsck\_msdos newfs\_msdos
189
190bzip2: bzcat bzip2 bunzip2
191
192one-true-awk: awk
193
194toolbox: getevent getprop
195
196toybox (0.8.0-ish): acpi base64 basename **bc** **blkid** blockdev cal cat **chattr** chcon chgrp
197chmod chown chroot chrt cksum clear cmp comm cp cpio cut date dd df
198diff dirname dmesg dos2unix du echo **egrep** env expand expr fallocate
199false **fgrep** file find flock fmt free **freeramdisk** **fsfreeze** **getconf**
200getenforce **getfattr** grep groups gunzip gzip head **help** hostname hwclock
201**i2cdetect** **i2cdump** **i2cget** **i2cset** **iconv** id ifconfig inotifyd insmod
202**install** ionice iorenice **iotop** kill killall ln load\_policy log logname
203losetup ls **lsattr** lsmod lsof lspci lsusb **makedevs** md5sum microcom
204mkdir mkfifo mknod mkswap mktemp modinfo modprobe more mount mountpoint
205mv **nbd-client** **nc** **netcat** netstat nice nl nohup **nproc** **nsenter** od **partprobe**
206paste patch pgrep pidof **ping** **ping6** **pivot\_root** pkill pmap printenv
207printf **prlimit** ps pwd **pwdx** readlink realpath renice restorecon **rev**
208**rfkill** rm rmdir rmmod runcon sed sendevent seq setenforce **setfattr**
209setprop setsid sha1sum sha224sum sha256sum sha384sum sha512sum sleep
210sort split start stat stop strings stty swapoff swapon sync sysctl
211tac tail tar taskset tee time timeout top touch tr **traceroute** **traceroute6**
212true truncate tty **tunctl** ulimit umount uname uniq unix2dos **unlink**
213**unshare** uptime usleep uudecode uuencode **uuidgen** **vconfig** vmstat **watch**
214wc which whoami xargs xxd yes zcat
215
216## Android 11 ("R")
217
218BSD: fsck\_msdos newfs\_msdos
219
220bzip2: bzcat bzip2 bunzip2
221
222gavinhoward/bc: bc
223
224one-true-awk: awk
225
226toolbox: getevent getprop setprop start stop
227
228toybox (0.8.3-ish): acpi base64 basename blkid blockdev cal cat chattr chcon chgrp chmod
229chown chroot chrt cksum clear cmp comm cp cpio cut date dd **devmem**
230df diff dirname dmesg dos2unix du echo egrep env expand expr fallocate
231false fgrep file find flock fmt free freeramdisk fsfreeze **fsync** getconf
232getenforce getfattr **getopt** grep groups gunzip gzip head help hostname
233hwclock i2cdetect i2cdump i2cget i2cset iconv id ifconfig inotifyd
234insmod install ionice iorenice iotop kill killall ln load\_policy log
235logname losetup ls lsattr lsmod lsof lspci lsusb makedevs md5sum microcom
236mkdir mkfifo mknod mkswap mktemp modinfo modprobe more mount mountpoint
237mv nbd-client nc netcat netstat nice nl nohup nproc nsenter od partprobe
238paste patch pgrep pidof ping ping6 pivot\_root pkill pmap printenv
239printf prlimit ps pwd pwdx **readelf** readlink realpath renice restorecon
240rev rfkill rm rmdir rmmod runcon sed sendevent seq setenforce setfattr
241setsid sha1sum sha224sum sha256sum sha384sum sha512sum sleep sort
242split stat strings stty swapoff swapon sync sysctl tac tail tar taskset
243tee time timeout top touch tr traceroute traceroute6 true truncate
244tty tunctl ulimit umount uname uniq unix2dos unlink unshare uptime
245usleep uudecode uuencode uuidgen vconfig **vi** vmstat watch wc which
246whoami xargs xxd yes zcat
247
248## Android ("S")
249
250BSD: fsck\_msdos newfs\_msdos
251
252bzip2: bzcat bzip2 bunzip2
253
254gavinhoward/bc: bc
255
256one-true-awk: awk
257
258toolbox: getevent getprop setprop start stop
259
260toybox (0.8.4-ish): **[** acpi base64 basename **blkdiscard** blkid blockdev cal cat chattr chcon
261chgrp chmod chown chroot chrt cksum clear cmp comm cp cpio cut date
262dd devmem df diff dirname dmesg dos2unix du echo egrep env expand
263expr fallocate false fgrep file find flock fmt free freeramdisk fsfreeze
264fsync getconf getenforce getfattr getopt grep groups gunzip gzip head
265help hostname hwclock i2cdetect i2cdump i2cget i2cset iconv id ifconfig
266inotifyd insmod install ionice iorenice iotop kill killall ln load\_policy
267log logname losetup ls lsattr lsmod lsof lspci lsusb makedevs md5sum
268microcom mkdir mkfifo mknod mkswap mktemp modinfo modprobe more mount
269mountpoint mv nbd-client nc netcat netstat nice nl nohup nproc nsenter
270od partprobe paste patch pgrep pidof ping ping6 pivot\_root pkill pmap
271printenv printf prlimit ps pwd pwdx readelf readlink realpath renice
272restorecon rev rfkill rm rmdir rmmod **rtcwake** runcon sed sendevent
273seq setenforce setfattr setsid sha1sum sha224sum sha256sum sha384sum
274sha512sum sleep sort split stat strings stty swapoff swapon sync sysctl
275tac tail tar taskset tee **test** time timeout top touch tr traceroute
276traceroute6 true truncate tty tunctl ulimit umount uname uniq unix2dos
277unlink unshare uptime usleep uudecode uuencode uuidgen vconfig vi
278vmstat watch wc which whoami xargs xxd yes zcat
279