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.
30
31Also note that in any given release `toybox` probably contains more
32commands than there are symlinks for in `/system/bin`. You can get the
33full list for a release by running `toybox` directly.
34
35
36## Android 2.3 (Gingerbread)
37
38BSD: cat dd newfs\_msdos
39
40toolbox: chmod chown cmp date df dmesg getevent getprop hd id ifconfig
41iftop insmod ioctl ionice kill ln log ls lsmod lsof mkdir mount mv
42nandread netstat notify printenv ps reboot renice rm rmdir rmmod route
43schedtop sendevent setconsole setprop sleep smd start stop sync top
44umount uptime vmstat watchprops wipe
45
46
47## Android 4.0 (IceCreamSandwich)
48
49BSD: cat dd newfs\_msdos
50
51toolbox: chmod chown cmp date df dmesg getevent getprop hd id ifconfig
52iftop insmod ioctl ionice kill ln log ls lsmod lsof mkdir mount mv
53nandread netstat notify printenv ps reboot renice rm rmdir rmmod route
54schedtop sendevent setconsole setprop sleep smd start stop sync top
55touch umount uptime vmstat watchprops wipe
56
57
58## Android 4.1-4.3 (JellyBean)
59
60BSD: cat cp dd du grep newfs\_msdos
61
62toolbox: chcon chmod chown clear cmp date df dmesg getenforce getevent
63getprop getsebool hd id ifconfig iftop insmod ioctl ionice kill ln
64load\_policy log ls lsmod lsof md5 mkdir mount mv nandread netstat notify
65printenv ps reboot renice restorecon rm rmdir rmmod route runcon schedtop
66sendevent setconsole setenforce setprop setsebool sleep smd start stop
67sync top touch umount uptime vmstat watchprops wipe
68
69
70## Android 4.4 (KitKat)
71
72BSD: cat cp dd du grep newfs\_msdos
73
74toolbox: chcon chmod chown clear cmp date df dmesg getenforce getevent
75getprop getsebool hd id ifconfig iftop insmod ioctl ionice kill ln
76load\_policy log ls lsmod lsof md5 mkdir mkswap mount mv nandread netstat
77notify printenv ps readlink renice restorecon rm rmdir rmmod route runcon
78schedtop sendevent setconsole setenforce setprop setsebool sleep smd start
79stop swapoff swapon sync top touch umount uptime vmstat watchprops wipe
80
81
82## Android 5.0 (Lollipop)
83
84BSD: cat chown cp dd du grep kill ln mv printenv rm rmdir sleep sync
85
86toolbox: chcon chmod clear cmp date df dmesg getenforce getevent getprop
87getsebool hd id ifconfig iftop insmod ioctl ionice load\_policy log ls
88lsmod lsof md5 mkdir mknod mkswap mount nandread netstat newfs\_msdos
89nohup notify ps readlink renice restorecon rmmod route runcon schedtop
90sendevent setenforce setprop setsebool smd start stop swapoff swapon
91top touch umount uptime vmstat watchprops wipe
92
93
94## Android 6.0 (Marshmallow)
95
96BSD: dd du grep
97
98toolbox: df getevent iftop ioctl ionice log ls lsof mount nandread
99newfs\_msdos ps prlimit renice sendevent start stop top uptime watchprops
100
101toybox: acpi basename blockdev bzcat cal cat chcon chgrp chmod chown
102chroot cksum clear comm cmp cp cpio cut date dirname dmesg dos2unix echo
103env expand expr fallocate false find free getenforce getprop groups
104head hostname hwclock id ifconfig inotifyd insmod kill load\_policy ln
105logname losetup lsmod lsusb md5sum mkdir mknod mkswap mktemp modinfo
106more mountpoint mv netstat nice nl nohup od paste patch pgrep pidof
107pkill pmap printenv printf pwd readlink realpath restorecon rm rmdir
108rmmod route runcon sed seq setenforce setprop setsid sha1sum sleep sort
109split stat strings swapoff swapon sync sysctl tac tail tar taskset tee
110time timeout touch tr true truncate umount uname uniq unix2dos usleep
111vmstat wc which whoami xargs yes
112
113
114## Android 7.0 (Nougat)
115
116BSD: dd grep
117
118toolbox: getevent iftop ioctl log nandread newfs\_msdos ps prlimit
119sendevent start stop top
120
121toybox: acpi base64 basename blockdev bzcat cal cat chcon chgrp chmod
122chown chroot cksum clear comm cmp cp cpio cut date df dirname dmesg
123dos2unix du echo env expand expr fallocate false find flock free
124getenforce getprop groups head hostname hwclock id ifconfig inotifyd
125insmod ionice iorenice kill killall load\_policy ln logname losetup ls
126lsmod lsof lsusb md5sum mkdir mknod mkswap mktemp modinfo more mount
127mountpoint mv netstat nice nl nohup od paste patch pgrep pidof pkill
128pmap printenv printf pwd readlink realpath renice restorecon rm rmdir
129rmmod route runcon sed seq setenforce setprop setsid sha1sum sleep sort
130split stat strings swapoff swapon sync sysctl tac tail tar taskset tee
131time timeout touch tr true truncate tty ulimit umount uname uniq unix2dos
132uptime usleep vmstat wc which whoami xargs xxd yes
133
134
135## Android 8.0 (Oreo)
136
137BSD: dd grep
138
139bzip2: bzcat bzip2 bunzip2
140
141toolbox: getevent newfs\_msdos
142
143toybox: acpi base64 basename blockdev cal cat chcon chgrp chmod chown
144chroot chrt cksum clear cmp comm cp cpio cut date df diff dirname dmesg
145dos2unix du echo env expand expr fallocate false file find flock free
146getenforce getprop groups gunzip gzip head hostname hwclock id ifconfig
147inotifyd insmod ionice iorenice kill killall ln load\_policy log logname
148losetup ls lsmod lsof lspci lsusb md5sum microcom mkdir mkfifo mknod
149mkswap mktemp modinfo modprobe more mount mountpoint mv netstat nice
150nl nohup od paste patch pgrep pidof pkill pmap printenv printf ps pwd
151readlink realpath renice restorecon rm rmdir rmmod runcon sed sendevent
152seq setenforce setprop setsid sha1sum sha224sum sha256sum sha384sum
153sha512sum sleep sort split start stat stop strings swapoff swapon sync
154sysctl tac tail tar taskset tee time timeout top touch tr true truncate
155tty ulimit umount uname uniq unix2dos uptime usleep uudecode uuencode
156vmstat wc which whoami xargs xxd yes zcat
157
158
159## Android 9.0 (Pie)
160
161BSD: dd grep
162
163bzip2: bzcat bzip2 bunzip2
164
165one-true-awk: awk
166
167toolbox: getevent getprop newfs\_msdos
168
169toybox: acpi base64 basename blockdev cal cat chcon chgrp chmod chown
170chroot chrt cksum clear cmp comm cp cpio cut date df diff dirname dmesg
171dos2unix du echo env expand expr fallocate false file find flock fmt free
172getenforce groups gunzip gzip head hostname hwclock id ifconfig inotifyd
173insmod ionice iorenice kill killall ln load\_policy log logname losetup ls
174lsmod lsof lspci lsusb md5sum microcom mkdir mkfifo mknod mkswap mktemp
175modinfo modprobe more mount mountpoint mv netstat nice nl nohup od paste
176patch pgrep pidof pkill pmap printenv printf ps pwd readlink realpath
177renice restorecon rm rmdir rmmod runcon sed sendevent seq setenforce
178setprop setsid sha1sum sha224sum sha256sum sha384sum sha512sum sleep
179sort split start stat stop strings stty swapoff swapon sync sysctl tac
180tail tar taskset tee time timeout top touch tr true truncate tty ulimit
181umount uname uniq unix2dos uptime usleep uudecode uuencode vmstat wc
182which whoami xargs xxd yes zcat
183
184
185## Android Q
186
187BSD: grep fsck\_msdos newfs\_msdos
188
189bzip2: bzcat bzip2 bunzip2
190
191one-true-awk: awk
192
193toolbox: getevent getprop
194
195toybox: acpi base64 basename bc blkid blockdev cal cat chattr chcon chgrp
196chmod chown chroot chrt cksum clear cmp comm cp cpio cut date dd df
197diff dirname dmesg dos2unix du echo egrep env expand expr fallocate
198false fgrep file find flock fmt free freeramdisk fsfreeze getconf
199getenforce getfattr grep groups gunzip gzip head help hostname hwclock
200i2cdetect i2cdump i2cget i2cset iconv id ifconfig inotifyd insmod
201install ionice iorenice iotop kill killall ln load\_policy log logname
202losetup ls lsattr lsmod lsof lspci lsusb makedevs md5sum microcom
203mkdir mkfifo mknod mkswap mktemp modinfo modprobe more mount mountpoint
204mv nbd-client nc netcat netstat nice nl nohup nproc nsenter od partprobe
205paste patch pgrep pidof ping ping6 pivot\_root pkill pmap printenv
206printf prlimit ps pwd pwdx readlink realpath renice restorecon rev
207rfkill rm rmdir rmmod runcon sed sendevent seq setenforce setfattr
208setprop setsid sha1sum sha224sum sha256sum sha384sum sha512sum sleep
209sort split start stat stop strings stty swapoff swapon sync sysctl
210tac tail tar taskset tee time timeout top touch tr traceroute traceroute6
211true truncate tty tunctl ulimit umount uname uniq unix2dos unlink
212unshare uptime usleep uudecode uuencode uuidgen vconfig vmstat watch
213wc which whoami xargs xxd yes zcat
214
215## Android R
216
217BSD: fsck\_msdos newfs\_msdos
218
219bzip2: bzcat bzip2 bunzip2
220
221gavinhoward/bc: bc
222
223one-true-awk: awk
224
225toolbox: getevent getprop setprop start stop
226
227toybox: acpi base64 basename blkid blockdev cal cat chattr chcon chgrp chmod
228chown chroot chrt cksum clear cmp comm cp cpio cut date dd devmem
229df diff dirname dmesg dos2unix du echo egrep env expand expr fallocate
230false fgrep file find flock fmt free freeramdisk fsfreeze fsync getconf
231getenforce getfattr getopt grep groups gunzip gzip head help hostname
232hwclock i2cdetect i2cdump i2cget i2cset iconv id ifconfig inotifyd
233insmod install ionice iorenice iotop kill killall ln load\_policy log
234logname losetup ls lsattr lsmod lsof lspci lsusb makedevs md5sum microcom
235mkdir mkfifo mknod mkswap mktemp modinfo modprobe more mount mountpoint
236mv nbd-client nc netcat netstat nice nl nohup nproc nsenter od partprobe
237paste patch pgrep pidof ping ping6 pivot\_root pkill pmap printenv
238printf prlimit ps pwd pwdx readelf readlink realpath renice restorecon
239rev rfkill rm rmdir rmmod runcon sed sendevent seq setenforce setfattr
240setsid sha1sum sha224sum sha256sum sha384sum sha512sum sleep sort
241split stat strings stty swapoff swapon sync sysctl tac tail tar taskset
242tee time timeout top touch tr traceroute traceroute6 true truncate
243tty tunctl ulimit umount uname uniq unix2dos unlink unshare uptime
244usleep uudecode uuencode uuidgen vconfig vi vmstat watch wc which
245whoami xargs xxd yes zcat
246