LinuxCommandLibrary

toybox

Implement many standard Linux utilities

TLDR

List all available Toybox commands

$ toybox
copy

Run a Toybox command explicitly (useful if another command with the same name exists in $PATH)
$ toybox [command] [arguments]
copy

List files in the current directory
$ toybox ls
copy

Remove a file
$ toybox rm [path/to/file]
copy

Display help information for a specific command
$ toybox [command] --help
copy

Display version
$ toybox --version
copy

SYNOPSIS

`toybox` is primarily invoked via symlinks or hardlinks to its embedded commands, or directly:

COMMAND [OPTIONS] [ARGUMENTS]

toybox [OPTIONS] [COMMAND [OPTIONS] [ARGUMENTS]]

The `OPTIONS` shown above for `toybox` itself are global options affecting `toybox` behavior, not the options for individual embedded commands.

PARAMETERS

--help
    Displays usage information for `toybox` itself or a specific embedded COMMAND if provided.

--version
    Shows the `toybox` version string and build configuration.

--install [-f]
    Creates symlinks (or hardlinks with `-f`) from standard paths (e.g., /bin, /usr/bin) to the `toybox` executable for all its built-in commands.

--uninstall
    Removes the symlinks or hardlinks created by `--install`.

--longhelp
    Provides more detailed help output, often including build-time options and environment variables.

--list
    Lists all the individual commands compiled into the current `toybox` binary.

--call [args...]
    Directly invokes a built-in `toybox` command for testing or specific execution, useful when symlinks aren't set up.

--sh
    Runs an interactive shell (typically ash) provided by `toybox`.

DESCRIPTION

`toybox` is a single executable that bundles many common Linux command-line utilities, similar to BusyBox but with a focus on a more permissive license and modern design principles. It provides a set of core utilities (like ls, cp, mv, grep, tar, and a shell) primarily for embedded systems and minimalist environments. Created by Rob Landley, who also worked on BusyBox, `toybox` aims to be a fully POSIX-compliant and LSB-compliant alternative, avoiding the GPLv2 licensing of BusyBox by using a BSD license. This makes it particularly suitable for projects like Android, where license flexibility is paramount. It emphasizes correctness, security, small size, and static linking, making it an efficient choice for resource-constrained devices. `toybox` typically operates by being invoked directly as `toybox ` or by having symlinks/hardlinks pointing from individual command names (e.g., ls) to the `toybox` binary itself.

CAVEATS

`toybox` prioritizes POSIX compliance and minimal resource usage, which sometimes means it does not implement all the non-standard extensions or features found in GNU coreutils. Users accustomed to GNU utilities might find slight behavioral differences or missing options for certain commands. It's primarily designed for embedded and resource-constrained environments rather than as a drop-in replacement for a full GNU/Linux desktop system.

LICENSING MODEL

`toybox` is licensed under a BSD license, which is much more permissive than the GPLv2 license used by its main competitor, BusyBox. This licensing choice was a fundamental driver for its creation and adoption in projects like Android, allowing wider commercial integration without copyleft concerns.

DESIGN PHILOSOPHY

The design emphasizes a small executable footprint, static linking to avoid library dependencies, and a strong focus on correctness, security, and strict adherence to POSIX standards. It is written from scratch, aiming for a cleaner, more maintainable codebase than some older utility collections, while also leveraging modern Linux syscalls.

ANDROID INTEGRATION

Since Android 6.0 (Marshmallow), `toybox` has been the standard collection of command-line utilities used within the Android operating system, providing essential tools for the shell and various system processes. This widespread adoption underscores its robustness and suitability for large-scale embedded deployments.

HISTORY

Development of `toybox` began around 2006 by Rob Landley, who previously maintained BusyBox. The primary motivation was to create a modern, clean-room implementation of common UNIX utilities under a permissive BSD license, circumventing the perceived complexities and restrictions of BusyBox's GPLv2 license for commercial embedded use. It gained significant traction and became the default set of utilities for the Android operating system starting with Android 6.0 Marshmallow, replacing older toolchains and solidifying its role in the embedded Linux ecosystem. `toybox` focuses on leveraging modern Linux kernel features and achieving rigorous POSIX compliance.

SEE ALSO

busybox(1), coreutils(1), sh(1), ls(1)

Copied to clipboard