Toybox

From Wikipedia, the free encyclopedia
Toybox
Original author(s)
Developer(s)Robert Landley and others
Initial release2006; 16 years ago (2006)
Stable release
0.8.6 / November 30, 2021; 2 months ago (2021-11-30)
Repository
Written inC
Operating systemUnix-like
Size3.30 MB (archived)
TypeIndependent SUSp XCU implementation
License0BSD[1][2]
Websitewww.landley.net/toybox

Toybox is a free and open-source software implementation of over 200 Unix command line utilities such as ls, cp, and mv. The Toybox project was started in 2006,[3] and became a 0BSD licensed BusyBox alternative.[4][5] Toybox is used for most of Android's command line tools in all currently supported Android versions, and is also used to build Android on Linux and macOS. All of the tools are tested on Linux, and many of them also work on BSD and macOS.

Functionality and aim[]

Toybox aims to provide a BSD licensed replacement for the GPL licensed BusyBox.[6] Toybox's major technical design goals are simplicity, smallness, speed and standard compliance.[7] Toybox aims to be mostly POSIX-2008 and LSB 4.1 compatible, and doesn't focus on having every option found in GNU counterparts.[3]

Toybox is licensed using the permissive 0BSD license, where BusyBox uses the copyleft GNU General Public License, which led to different usage domains. BusyBox is mostly used in the copyleft FOSS domain, while Toybox is used mostly with permissive licensed projects and by commercial companies, e.g. Google's Android,[8] which is an explicit target of Toybox.[9] Feature-wise, Toybox has not reached parity with BusyBox.

History[]

Toybox was started in early 2006 by Rob Landley[3][5] after he ended his BusyBox maintainership due to a dispute with Bruce Perens, the original creator of BusyBox.[10] In 2008 the project went dormant.[4] At the end of 2011 Sony employee Tim Bird suggested creating a permissively licensed alternative to BusyBox.[6] Rob Landley agreed with this goal and resumed work on Toybox, starting by relicensing from the GPL-2.0-only license to the BSD-2-Clause license.[11][12] In March 2013 the project was relicensed to an even more permissive 0BSD license.[13]

At the end of 2014 Toybox was integrated into the Android 6.0.x "Marshmallow" development branches for use on devices.[14][8][15] In 2018 a host Toybox prebuilt was added to AOSP to help make the Android build itself more hermetic.[16]

Controversy[]

In January 2012 the proposal of creating a BSD license alternative to the GPL licensed BusyBox project drew harsh criticism from Matthew Garrett for taking away the only relevant tool for copyright enforcement of the Software Freedom Conservancy group.[17] Rob Landley, who had started the BusyBox-based lawsuits, responded that this was intentional, explaining that the lawsuits had not benefited the project but that they had led to corporate avoidance, expressing a desire to stop the lawsuits "in whatever way I see fit".[18][19][20]

Project progress[]

The official Toybox documentation lists an overview of the available, partially available, and missing commands.[21] As of November 2021, Version 0.8.6 achieves approximately 80% of the project's implementation goals targeted for 1.0.[22]

List of Toybox Commands
  • acpi — Show status of power sources and thermal devices.
  • , — Add a user or group to the system.
  • ar — Create, modify, and extract from archives.
  • — Print machine (hardware) name, same as uname -m.
  • arp — The Address Resolution Protocol (ARP)
  • arping — Send ARP REQUEST to a neighbour host
  • ascii — Display ascii character set.
  • at — Execute commands at a later time.
  • awk — pattern scanning and processing language.
  • base32 — Encode or decode in base32.
  • base64 — Encode or decode in base64.
  • basename — Return non-directory portion of a pathname removing suffix.
  • bc — Arbitrary-precision arithmetic language.
  • — Discard device sectors.
  • blkid — Print type, label and UUID of filesystem on a block device or image.
  • — Call ioctls on each listed block device.
  • bunzip2 — Decompress bzip2 files.
  • — Decompress bzip2 files to stdout.
  • cal — Print a calendar.
  • cat — Copy (concatenate) files to stdout.
  • — Display nonprinting characters as escape sequences.
  • cd — Change the working directory.
  • chattr — Change file attributes on a Linux file system.
  • chgrp — Change group of one or more files.
  • chmod — Change mode of listed files.
  • chown — Change owner of one or more files.
  • chroot — Run command within a new root directory.
  • — Get/set a process' real-time scheduling policy and priority.
  • chsh — Change your login shell.
  • — Change to virtual terminal number N.
  • cksum — For each file, output crc32 checksum value, length and name of file.
  • clear — Clear the screen.
  • cmp — Compare the contents of two files.
  • comm — Select or reject lines common to two files.
  • — Copy stdin to stdout, displaying simple progress indicator to stderr.
  • cp — Copy files.
  • cpio — Copy files into and out of a "newc" format cpio archive.
  • crc32 — Output crc32 checksum for each file.
  • cut — Print selected parts of lines from each FILE to standard output.
  • dd — Convert and copy a file.
  • date — Set/get the current date/time.
  • — Read/write physical address via /dev/mem.
  • df — Shows total/used/available disk space for each filesystem listed on the command line, or all currently mounted filesystems.
  • diff - Compare two files.
  • dirname — Show directory portion of path.
  • dmesg — Print or control the kernel ring buffer.
  • — Show domain this system belongs to (same as hostname -d).
  • dos2unix — Convert newline format from dos "\r\n" to unix "\n".
  • du — Show disk usage, space consumed by files and directories.
  • echo — Write each argument to stdout, with one space between each, followed by a newline.
  • egrep — Show lines matching extended regular expressions.
  • — Eject DEVICE or default /dev/cdrom.
  • env — Set the environment for command invocation, or list environment variables.
  • expand — Expand tabs to spaces according to tabstops.
  • factor — Factor integers.
  • — Tell the filesystem to allocate space for a file.
  • false — Return nonzero.
  • fdisk — Manipulate disk partition table.
  • fgrep — Show lines matching regular expressions.
  • file — Examine the given files and describe their content types.
  • find — Search directories for matching files.
  • flock — Manage advisory file locks.
  • fold — Filter for folding lines.
  • fmt — Reformat input to wordwrap at a given line length, preserving existing indentation level, writing to stdout.
  • — Display the total, free and used amount of physical memory and swap space.
  • — Free all memory allocated to specified ramdisk.
  • — Freeze or unfreeze a filesystem.
  • — Print type of filesystem on a block device or image.
  • fsync — Synchronize a file's in-core state with storage device.
  • — Use File Transfer Protocol (FTP) to get a file from an FTP server.
  • — Use File Transfer Protocol (FTP) to put a file to an FTP server.
  • — Get system configuration values.
  • grep — Show lines matching regular expressions.
  • groups — Print the groups a user is in.
  • gunzip — Decompress gz files.
  • — Restart, halt or powerdown the system.
  • head — Copy first lines from files to stdout.
  • help — Show usage information for toybox commands.
  • hexedit — Hexadecimal file editor.
  • hostname — Get/set the current hostname.
  • — Get/set the hardware clock.
  • — Detect i2c devices.
  • — Dump i2c registers.
  • — Read an i2c register.
  • — Write an i2c register.
  • iconv — Convert character encoding of files.
  • id — Print user and group ID.
  • ifconfig — Display or configure network interface.
  • — Run a program when a filesystem event occurs.
  • insmod — Load the module named MODULE passing options if given.
  • install — Copy files and set attributes.
  • ionice — Change the I/O scheduling priority of a process.
  • — Display or change I/O priority of existing process.
  • — Rank processes by I/O.
  • kill — Send signal to process.
  • killall — Send a signal (default: TERM) to all processes with the given names.
  • — Send a signal to all processes outside current session.
  • less — opposite of more
  • link — Create hardlink to a file.
  • ln — Create a link between FROM and TO.
  • logger — Log message (or stdin) to syslog.
  • login — Log in as a user, prompting for username and password if necessary.
  • logname — Print the current user name.
  • losetup — Associate a loopback device with a file, or show current file (if any) associated with a loop device.
  • ls — List files.
  • lsattr — List file attributes on a Linux file system.
  • lsmod — Display the currently loaded modules, their sizes and their dependencies.
  • lspci — List PCI devices.
  • lsusb — List USB hosts/devices.
  • — Create a range of special files as specified in a device table.
  • — Generate a 128-bit strong random number.
  • md5sum — Calculate md5 hash for each input file, reading from stdin if none.
  • — Simple serial console.
  • — List OSS sound channels (module snd-mixer-oss), or set volumes.
  • mkdir — Create one or more directories.
  • mkfifo — Create FIFOs (named pipes).
  • mknod — Create a special file NAME with a given type.
  • — Crypt PASSWORD using crypt(3).
  • mkswap — Set up a Linux swap area on a device or file.
  • mktemp — Safely create a new file "DIR/TEMPLATE" and print its name.
  • — Display module fields for modules specified by name or .ko path.
  • mount — Mount new filesystems on directories.
  • — Check whether the directory or device is a mountpoint.
  • mv — Move files.
  • — Connect to an NBD server.
  • nc/netcat — Forward stdin/stdout to a file or network connection.
  • netstat — Display networking information.
  • nice — Run a command line at an increased or decreased scheduling priority.
  • nl — Number lines of input.
  • nohup — Run a command that survives the end of its terminal.
  • — Print number of processors.
  • — Run COMMAND in an existing (set of) namespaces.
  • od — Dump data in octal/hex.
  • — Simple init program that runs a single supplied command line
  • partprobe — Tell the kernel about partition table changes.
  • passwd — Update user's authentication tokens.
  • paste — Merge corresponding lines from each input file.
  • patch — Apply a unified diff to one or more files.
  • pgrep — Search for process(es).
  • — Print the PIDs of all processes with the given names.
  • ping — Check network connectivity by sending packets to a host and reporting its response.
  • pivot root — Swap OLD and NEW filesystems (as if by simultaneous mount—move), and move all processes with chdir or chroot under OLD into NEW (including kernel threads) so OLD may be unmounted.
  • pkill — look up or signal processes based on name and other
  • — Report the memory map of a process or processes.
  • — Restart, halt or powerdown the system.
  • printenv — Print environment variables.
  • printf — Format and print ARGUMENT according to FORMAT, using C printf syntax.
  • — Print or set resource limits for process number PID.
  • ps — List processes.
  • pwd — Print working (current) directory.
  • — Print working directory of processes listed on command line.
  • readahead — Preload files into disk cache.
  • — Show what symlink points to.
  • — Display the canonical absolute pathname
  • reboot — Restart, halt or powerdown the system.
  • renice — set nice values of running processes
  • reset — Reset the terminal.
  • — Output each line reversed, when no files are given stdin is used.
  • — Enable/disable wireless devices.
  • rm — Remove each argument from the filesystem.
  • rmdir — Remove one or more directories.
  • — Unload the module named MODULE from the Linux kernel.
  • — Enter the given sleep state until the given time.
  • sed — Stream editor.
  • seq — Count from first to last, by increment.
  • — Write POSIX extended attributes.
  • — Run process in a new session.
  • sha1sum — Calculate sha hash for each input file, reading from stdin if none.
  • shred — Securely delete a file by overwriting its contents with random data.
  • sleep — Wait before exiting.
  • — Simple Network Time Protocol client.
  • sort — Sort all lines of text from input files (or stdin) to stdout.
  • split — Copy INPUT (or stdin) data to a series of OUTPUT (or "x") files with alphabetically increasing suffix (aa, ab, ac... az, ba, bb...).
  • stat — Display status of files or filesystems.
  • strings — Display printable strings in a binary file
  • su — Switch user, prompting for password of new user when not run as root.
  • swapoff — Disable swapping on a given swapregion.
  • swapon — Enable swapping on a given device/file.
  • — Use from PID 1 under initramfs to free initramfs, chroot to NEW_ROOT, and exec NEW_INIT.
  • sync — Write pending cached data to disk (synchronize), blocking until done.
  • sysctl — Read/write system control data (under /proc/sys).
  • tac — Output lines in reverse order.
  • tail — Copy last lines from files to stdout.
  • tar — Create, extract, or list files in a .tar (or compressed t?z) file.
  • — Launch a new task which may only run on certain processors, or change the processor affinity of an existing PID.
  • tee — Copy stdin to each listed file, and also to stdout.
  • test — Return true or false by performing tests.
  • time — Run command line and report real, user, and system time elapsed in seconds.
  • timeout — Run command line as a child process, sending child a signal if the command doesn't exit soon enough.
  • top — Show process activity in real time.
  • touch — Update the access and modification times of each FILE to the current time.
  • true — Return zero.
  • truncate — Set length of files, extending sparsely if necessary.
  • tty — Show filename of terminal connected to stdin.
  • — Create and delete tun/tap virtual ethernet devices.
  • — Print or set resource limits for process number PID.
  • umount — Unmount the listed filesystems.
  • uname — Print system information.
  • unicode — universal character set.
  • uniq — Report or filter out repeated lines in a file.
  • unix2dos — Convert newline format from unix "\n" to dos "\r\n".
  • unlink — Delete one file.
  • — Create new container namespace for this process and its children, so some attribute is not shared with the parent process.
  • uptime — Tell the current time, how long the system has been running, the number of users, and the system load averages for the past 1, 5 and 15 minutes.
  • — Pause for MICROSECONDS microseconds.
  • uudecode — Decode a uuencoded file.
  • uuencode — Encode a binary file.
  • — Create and print a new RFC4122 random UUID.
  • — Create and remove virtual ethernet devices.
  • vmstat — Print virtual memory statistics.
  • w — Show who is logged on and since how long they logged in.
  • watch — Run PROG every -n seconds, showing output.
  • wc — Count lines, words, and characters in input.
  • which — Search $PATH for executable files matching filenames.
  • — software watchdog daemon.
  • who — Print information about logged in users.
  • whoami — Print the current user name.
  • xargs — Run command line one or more times, appending arguments from stdin.
  • xxd — Hexdump a file to stdout.
  • yes — Repeatedly output line until killed.
  • zcat — Decompress gz files to stdout.

See also[]

References[]

  1. ^ Toybox is released under the following "zero clause" BSD license by Rob Landley
  2. ^ "Simplify license text, as mentioned on the mailing list". 2013-03-14. Retrieved 2021-06-29.
  3. ^ a b c Landley, Robert. "What is ToyBox?". Toybox project website. Retrieved 13 July 2012.
  4. ^ a b Dj Walker-Morgan. "Inside the ToyBox: An interview with Rob Landley". Retrieved 13 July 2012.
  5. ^ a b Varghese, Sam (2012-02-01). "BusyBox replacement project fuels animated verbal spat". IT Wire. Retrieved 2013-05-12.
  6. ^ a b "Busybox replacement project". 2012-01-11. Retrieved 2014-03-04.
  7. ^ Landley, Robert. "Design Docs". Toybox project website. Retrieved 18 February 2015. Toybox combines the most common Linux command line utilities together into a single BSD-licensed executable. It's simple, small, fast, and reasonably standards-compliant ( and LSB 4.1).
  8. ^ a b toybox on android.googlesource.com (2014-12-28)
  9. ^ celf-2015.txt by Rob Landley (2015)
  10. ^ Landley, Robert (2006-09-30). "I'm going out now. I may be some time". busybox (Mailing list).
  11. ^ Toybox relaunch on toybox.landley.narkive.com (2011-11-20)
  12. ^ Switch to 2-clause BSD license (with caveat about scripts directory). 0.2.0 by landley on 15 Nov 2011
  13. ^ Simplify license text, as mentioned on the mailing list. by Landley (14 Mar 2013)
  14. ^ Android gets a toybox on lwn.net by Jake Edge (January 14, 2015)
  15. ^ Issue 76861: Importing parts of Toybox into Android, including dos2unix, unix2dos, sort, uniq, and usleep
  16. ^ "Start using the toybox prebuilt".
  17. ^ "Garrett: The ongoing fight against GPL enforcement". LWN.net. 2012-01-31. Retrieved 2014-03-04. The real problem here is that the [Software Freedom Conservancy's] reliance on Busybox means that they're only able to target infringers who use that Busybox code. No significant kernel copyright holders have so far offered to allow the SFC to enforce their copyrights, with the result that enforcement action will grind to a halt as vendors move over to this Busybox replacement.
  18. ^ "Garrett: The ongoing fight against GPL enforcement". LWN.net. 2012-01-31. Retrieved 2014-03-04. >As the ex-maintainer of busybox who STARTED those lawsuits in the first place and now HUGELY REGRETS ever having done so, I think I'm entitled to stop the lawsuits in whatever way I see fit. They never resulted in a single line of code added to the busybox repository. They HAVE resulted in more than one company exiting Linux development entirely and switching to non-Linux operating systems for their embedded products, and they're a big part of the reason behind Android's "No GPL in userspace" policy.
  19. ^ Proffitt, Brian (2012-02-02). "GPL enforcement sparks community flames - Throwing the GPL baby out with the enforcement bath water?". ITworld. Retrieved 2015-03-04.
  20. ^ Landley, Rob. "Embedded Linux Conference 2013 - Toybox: Writing a New Command Line" (video). The Linux Foundation. Archived from the original on 2021-12-21. Retrieved 2016-06-24.
  21. ^ Toybox Status
  22. ^ Project progress for 0.8.6

External links[]

Retrieved from ""