coreutils Documentation

Cross-platform Rust rewrite of the GNU coreutils

23,921 stars Rust Rust 1 file ยท ~6,881 tokens #busybox#command-line-tool#coreutils#cross-platform#gnu-coreutils#rust
RAW Doc

1. Project Overview & Quickstart (uutils/coreutils)

File: README.md


uutils coreutils is a cross-platform reimplementation of the GNU coreutils in
Rust. While all programs have been implemented, some
options might be missing or different behavior might be experienced.

We provide prebuilt binaries, manpages, and shell completions from main branch at https://github.com/uutils/coreutils/releases/tag/latest-commit .
The latest stable tag https://github.com/uutils/coreutils/releases/latest also exists for reproducible products and packagers.
Bug reporters should use binary from latest commit.

Minimal compatible glibc version is same with ubuntu-latest runner. Use coreutils-*-musl if coreutils-*-gnu is not compatible with your system.

Goals

uutils coreutils aims to be a drop-in replacement for the GNU utils. Differences with GNU
are treated as bugs.

Our key objectives include:

  • Matching GNU's output (stdout and error code) exactly
  • Better error messages
  • Providing comprehensive internationalization support (UTF-8)
  • Improved performances
  • Extensions when relevant (example: --progress)

uutils aims to work on as many platforms as possible, to be able to use the same
utils on Linux, macOS, *BSD, Windows, WASI and other platforms. This ensures, for example,
that scripts can be easily transferred between platforms.

uutils coreutils ships by default on Ubuntu since version 25.10.

Documentation

uutils has both user and developer documentation available:

Both can also be generated locally, the instructions for that can be found in
the coreutils docs repository.

Use weblate/rust-coreutils to translate the Rust coreutils into your language.

You can try the utilities in your browser through the
WebAssembly playground, without
installing anything.

Requirements

  • Rust (cargo, rustc)
  • GNU Make (optional)

Rust Version

uutils follows Rust's release channels and is tested against stable, beta and
nightly.

Building

There are currently two methods to build the uutils binaries: either Cargo or
GNU Make.

Building the full package, including all documentation, requires both Cargo
and GNU Make on a Unix platform.

For either method, we first need to fetch the repository:

shell
git clone https://github.com/uutils/coreutils
cd coreutils

Cargo

Building uutils using Cargo is easy because the process is the same as for every
other Rust program:

shell
cargo build --release

Replace --release with --profile=release-small to optimize binary size.

This command builds the most portable common core set of uutils into a multicall
(BusyBox-type) binary, named 'coreutils', on most Rust-supported platforms.

Additional platform-specific uutils are often available. Building these expanded
sets of uutils for a platform (on that platform) is as simple as specifying it
as a feature:

shell
cargo build --release --features windows
# or ...
cargo build --release --features unix
# or ...
cargo build --release --target wasm32-wasip1 --no-default-features --features feat_wasm

To build SELinux-specific features, including chcon and runcon, ensure that libselinux
and libclang are installed on your system. Then, run the following command:

text
cargo build --release --features unix,feat_selinux

To speed up the checksum utilities (md5sum, sha1sum, sha224sum, sha256sum,
sha384sum, sha512sum, and cksum) by using OpenSSL's libcrypto instead of
the pure-Rust digest crates, enable the openssl feature:

text
cargo build --release --features openssl

By default OpenSSL is built from source and statically linked into the
binary (mirroring how expr links oniguruma), so no runtime dependency
on system libcrypto/libssl is added. To link dynamically against the system
libcrypto instead, set OPENSSL_NO_VENDOR=1 at build time.

The speedup is largest on CPUs without SHA-NI hardware acceleration. The
feature is a no-op on Windows (the pure-Rust implementations are always used
there) and is automatically bypassed at runtime for any algorithm libcrypto
refuses (for example, MD5 in strict FIPS mode).

If you don't want to build every utility available on your platform into the
final binary, you can also specify which ones you want to build manually. For
example:

shell
cargo build --features "base32 cat echo rm" --no-default-features

If you want to build the utilities as individual binaries, that is also possible:

shell
cargo build --release --bins --workspace --exclude coreutils --exclude uu_runcon --exclude uu_chcon

Each utility is contained in its own package within the main repository, named "uu_UTILNAME". To
build selected individual utilities, use the --package [aka -p] option. For example:

shell
cargo build -p uu_base32 -p uu_cat -p uu_echo -p uu_rm

GNU Make

Building using make is a simple process as well.

To simply build all available utilities (with debug profile):

shell
make

In release mode:

shell
make PROFILE=release

To build all but a few of the available utilities:

shell
make SKIP_UTILS='UTILITY_1 UTILITY_2'

To build only a few of the available utilities:

shell
make UTILS='UTILITY_1 UTILITY_2'

Installation

Install with Cargo

Likewise, installing can simply be done using:

shell
cargo install --path . --locked

This command will install uutils into Cargo's bin folder (e.g.
$HOME/.cargo/bin).

This does not install files necessary for shell completion or manpages. For
manpages or shell completion to work, use GNU Make or see
Manually install shell completions/Manually install manpages.

Install with GNU Make

To install all available utilities (PROFILE=release by default):

shell
make install

To install using sudo switch -E must be used:

shell
sudo -E make install

To install all but a few of the available utilities:

shell
make SKIP_UTILS='UTILITY_1 UTILITY_2' install

To install only a few of the available utilities:

shell
make UTILS='UTILITY_1 UTILITY_2' install

To install every program with a prefix (e.g. uu-echo uu-cat):

shell
make PROG_PREFIX=uu- install

To install the multicall binary:

shell
make MULTICALL=y install

Set install parent directory (default value is /usr/local):

shell
# DESTDIR is also supported
make PREFIX=/my/path install

Installing with make installs shell completions for all installed utilities
for bash, fish and zsh. Completions for elvish and powershell can also
be generated; See Manually install shell completions.

To skip installation of completions and manpages:

shell
make COMPLETIONS=n MANPAGES=n install

Manually install shell completions

The uudoc binary generates completions for the bash, elvish,
fish, powershell and zsh shells to stdout.

Install uudoc by

shell
cargo install --bin uudoc --features uudoc --path .

Then use the installed binary:

shell
uudoc completion  <shell>

So, to install completions for ls on bash to
/usr/local/share/bash-completion/completions/ls, run:

shell
uudoc completion ls bash > /usr/local/share/bash-completion/completions/ls.bash

Completion for prefixed cp with uu- on zsh is generated by

shell
env PROG_PREFIX=uu- uudoc completion cp zsh

Manually install manpages

To generate manpages, the syntax is:

bash
uudoc manpage

So, to install the manpage for ls to /usr/local/share/man/man1/ls.1 run:

bash
uudoc manpage ls > /usr/local/share/man/man1/ls.1

Un-installation

Un-installation differs depending on how you have installed uutils. If you used
Cargo to install, use Cargo to uninstall. If you used GNU Make to install, use
Make to uninstall.

Uninstall with Cargo

To uninstall uutils:

shell
cargo uninstall coreutils

Uninstall with GNU Make

To uninstall all utilities:

shell
make uninstall

To uninstall every program with a set prefix:

shell
make PROG_PREFIX=uu- uninstall

To uninstall the multicall binary:

shell
make MULTICALL=y uninstall

To uninstall from a custom parent directory:

shell
# DESTDIR is also supported
make PREFIX=/my/path uninstall

GNU test suite compatibility

Below is the evolution of how many GNU tests uutils passes. A more detailed
breakdown of the GNU test results of the main branch can be found
in the user manual.

See https://github.com/orgs/uutils/projects/1 for the main meta bugs
(many are missing).

Contributing

To contribute to uutils, please see CONTRIBUTING.

License

uutils is licensed under the MIT License - see the LICENSE file for details

GNU Coreutils is licensed under the GPL 3.0 or later.


File: docs/src/extensions.md

Extensions over GNU

Though the main goal of the project is compatibility, uutils supports a few
features that are not supported by GNU coreutils. We take care not to introduce
features that are incompatible with the GNU coreutils. Below is a list of uutils
extensions.

General

GNU coreutils provides two ways to define short options taking an argument:

text
$ ls -w 80
$ ls -w80

We support a third way:

text
$ ls -w=80

With GNU coreutils, --help usually prints the help message and --version prints the version.
We also commonly provide short options: -h for help and -V for version.

`coreutils`

Our coreutils calls utility by coreutils utility-name and has --list to run against busybox test suite.
Our coreutils is called as utility-name if its binary name ends with utility-name to support prefixed names.
Longer name is prioritized e.g. sum with the prefix ck is called as cksum.

`base32/base64/basenc`

Just like on macOS, base32/base64/basenc provides -D to decode data.

`cp`

cp can display a progress bar when the -g/--progress flag is set.

`du`

du allows birth and creation as values for the --time argument to show the creation time. It
also provides a -v/--verbose flag.

`env`

GNU env allows the empty string to be used as an environment variable name.
This is unsupported by uutils, which will show a warning for any such
assignment.

env has an additional -f/--file flag that can
parse .env files and set variables accordingly. This feature is adopted from dotenv style
packages.

`expand`

expand offers the -U/--no-utf8 option to interpret input files as 8-bit ASCII instead of UTF-8.

`fmt`

fmt has additional flags for prefixes: -P/--skip-prefix, -x/--exact-prefix, and
-X/--exact-skip-prefix. With -m/--preserve-headers, an attempt is made to detect and preserve
mail headers in the input. -q/--quick breaks lines more quickly. And -T/--tab-width defines the
number of spaces representing a tab when determining the line length.

`id`

id has three additional flags:

  • -P displays the id as a password file entry
  • -p makes the output human-readable
  • -A displays the process audit user ID

`install`

install offers FreeBSD's -U unprivileged option to not change the owner, the group, or the file flags of the destination.

`ls`

GNU ls provides two ways to use a long listing format: -l and --format=long. We support a
third way: --long.

GNU ls --sort=VALUE only supports special non-default sort orders.
We support --sort=name, which makes it possible to override an earlier value.

`more`

We provide a simple implementation of more, which is not part of GNU
coreutils. We do not aim for full compatibility with the more utility from
util-linux. Features from more modern pagers (like less and bat) are
therefore welcomed.

`mv`

mv can display a progress bar when the -g/--progress flag is set.

`printf`

printf uses arbitrary precision decimal numbers to parse and format floating point
numbers. GNU coreutils uses long double, whose actual size may be double precision
64-bit float

(e.g 32-bit arm), extended precision 80-bit float
(x86(-64)), or
quadruple precision 128-bit float (e.g. arm64).

Practically, this means that printing a number with high precision will remain exact:

text
printf "%.48f\n" 0.1
0.100000000000000000000000000000000000000000000000 << uutils on all platforms
0.100000000000000000001355252715606880542509316001 << GNU coreutils on x86(-64)
0.100000000000000000000000000000000004814824860968 << GNU coreutils on arm64
0.100000000000000005551115123125782702118158340454 << GNU coreutils on armv7 (32-bit)

Hexadecimal floats

For hexadecimal float format (%a), POSIX only states that one hexadecimal number
should be present left of the decimal point (0xh.hhhhpยฑd [1]), but does not say how
many bits should be included (between 1 and 4). On x86(-64), the first digit always
includes 4 bits, so its value is always between 0x8 and 0xf, while on other
architectures, only 1 bit is included, so the value is always 0x1.

However, the first digit will of course be 0x0 if the number is zero. Also,
rounding numbers may cause the first digit to be 0x1 on x86(-64) (e.g.
0xf.fffffffp-5 rounds to 0x1.00p-1), or 0x2 on other architectures.

We chose to replicate x86-64 behavior on all platforms.

Additionally, the default precision of the hexadecimal float format (%a without
any specifier) is expected to be "sufficient for exact representation of the value" [1].
This is not possible in uutils as we store arbitrary precision numbers that may be
periodic in hexadecimal form (0.1 = 0xc.ccc...p-7), so we revert
to the number of digits that would be required to exactly print an
extended precision 80-bit float,
emulating GNU coreutils behavior on x86(-64). An 80-bit float has 64 bits in its
integer and fractional part, so 16 hexadecimal digits are printed in total (1 digit
before the decimal point, 15 after).

Practically, this means that the default hexadecimal floating point output is
identical to x86(-64) GNU coreutils:

text
printf "%a\n" 0.1
0xc.ccccccccccccccdp-7 << uutils on all platforms
0xc.ccccccccccccccdp-7 << GNU coreutils on x86-64
0x1.999999999999999999999999999ap-4 << GNU coreutils on arm64
0x1.999999999999ap-4   << GNU coreutils on armv7 (32-bit)

We can print an arbitrary number of digits if a larger precision is requested,
and the leading digit will still be in the 0x8-0xf range:

text
printf "%.32a\n" 0.1
0xc.cccccccccccccccccccccccccccccccdp-7 << uutils on all platforms
0xc.ccccccccccccccd00000000000000000p-7 << GNU coreutils on x86-64
0x1.999999999999999999999999999a0000p-4 << GNU coreutils on arm64
0x1.999999999999a0000000000000000000p-4 << GNU coreutils on armv7 (32-bit)

Note: The architecture-specific behavior on non-x86(-64) platforms may change in
the future.

`rm`

rm can display a progress bar when the -g/--progress flag is set.

`seq`

Unlike GNU coreutils, seq always uses arbitrary precision decimal numbers, no
matter the parameters (integers, decimal numbers, positive or negative increments,
format specified, etc.), so its output will be more correct than GNU coreutils for
some inputs (e.g. small fractional increments where GNU coreutils uses long double).

The only limitation is that the position of the decimal point is stored in a i64,
so values smaller than 10**(-263) will underflow to 0, and some values larger
than 10
(2**63) may overflow to infinity.

See also comments under printf for formatting precision and differences.

seq provides -t/--terminator to set the terminator character.

`sort`

When sorting with -g/--general-numeric-sort, arbitrary precision decimal numbers
are parsed and compared, unlike GNU coreutils that uses platform-specific long
double floating point numbers.

Extremely large or small values can still overflow or underflow to infinity or zero,
see note in seq.

`unexpand`

GNU unexpand provides --first-only to convert only leading sequences of blanks. We support a
second way: -f like busybox.

With -U/--no-utf8, you can interpret input files as 8-bit ASCII rather than UTF-8.

`uptime`

Similar to the proc-ps implementation and unlike GNU/Coreutils, uptime provides:

  • -s/--since to show since when the system is up
  • -p/--pretty to display uptime in a pretty-printed format

File: docs/src/index.md

{{#include logo.svg}}

uutils Coreutils Documentation

uutils is an attempt at writing universal (as in cross-platform) CLI utilities
in Rust. It is available for Linux, Windows, Mac
and other platforms.

The API reference for uucore, the library of functions shared between various
utils, is hosted at docs.rs.

uutils is licensed under the
MIT License.

Note: This manual is automatically generated from the source code and is a
work in progress.


File: docs/src/installation.md

Installation

This is a list of uutils packages in various distributions and package managers.
Note that these are packaged by third-parties and the packages might contain
patches.

You can also build uutils from source.

Cargo

shell
# Unix like
cargo install coreutils --features unix --locked
# Windows
cargo install coreutils --features windows --locked

Linux

Alpine

shell
apk update uutils-coreutils

Note: Requires the edge repository.

Arch

shell
pacman -S uutils-coreutils

Debian

shell
apt install rust-coreutils
# To use it:
export PATH=/usr/lib/cargo/bin/coreutils:$PATH

Fedora

shell
dnf install uutils-coreutils
# To use it:
export PATH=/usr/libexec/uutils-coreutils:$PATH

Gentoo

shell
emerge -pv sys-apps/uutils-coreutils

Manjaro



shell
pacman -S uutils-coreutils
# or
pamac install uutils-coreutils

NixOS

shell
nix-env -iA nixos.uutils-coreutils

OpenMandriva Lx

shell
dnf install uutils-coreutils

RHEL/AlmaLinux/CENTOS Stream/Rocky Linux/EPEL 9

shell
# Install EPEL 9 - Specific For RHEL please check codeready-builder-for-rhel-9 First then install epel
dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm -y
# Install Core Utils
dnf install uutils-coreutils
# To use it:
export PATH=/usr/libexec/uutils-coreutils:$PATH

Ubuntu

shell
apt install rust-coreutils
# To use it:
export PATH=/usr/lib/cargo/bin/coreutils:$PATH

AUR

Build main branch from source
or
Binaries from main branch

shell
git clone https://aur.archlinux.org/uutils-coreutils-git --depth=1
cd uutils-coreutils-git
makepkg -si

MacOS

Homebrew

shell
brew install uutils-coreutils

MacPorts

text
port install coreutils-uutils

FreeBSD

sh
pkg install rust-coreutils

Windows

Winget

shell
winget install uutils.coreutils

Scoop

Scoop package

shell
scoop install uutils-coreutils

MSYS2

MSYS2 package (Windows native)

MSYS2 package (Cygwin)

Alternative installers

Conda

Conda package

text
conda install -c conda-forge uutils-coreutils

Yocto

Yocto recipe

The uutils-coreutils recipe is provided as part of the meta-openembedded yocto layer.
Clone poky and meta-openembedded, add
meta-openembedded/meta-oe as layer in your build/conf/bblayers.conf file,
and then either call bitbake uutils-coreutils, or use
PREFERRED_PROVIDER_coreutils = "uutils-coreutils" in your build/conf/local.conf file and
then build your usual yocto image.


File: docs/src/multicall.md

Multi-call binary

uutils includes a multi-call binary from which the utils can be invoked. This
reduces the binary size of the binary and can be useful for portability.

The first argument of the multi-call binary is the util to run, after which
the regular arguments to the util can be passed.

shell
coreutils [util] [util options]

The --help flag will print a list of available utils.

Example

shell
coreutils ls -l

File: docs/src/packaging.md

Packaging coreutils

Note: This page is intended as a guide for packaging the uutils coreutils
for package maintainers. Normal users probably do not need to read this. If you
just want to install the coreutils, look at the
installation instructions.

The maintainers of this project do not have the capacity to maintain packages
for every distribution and package manager out there. Therefore, we encourage
other people to package the uutils coreutils for their preferred distributions.
You do not need to ask permission for this and you can do this however you want
as long as you comply with the license. However, we do like to hear and
advertise where the uutils coreutils are available, so please do let us know!

License

The uutils coreutils are licensed under the MIT license. See the
LICENSE for the full
license text. Make sure to add attribution and the license text to the package
to comply with the license.

Package

We recommend to name the package uutils-coreutils. Just uutils is incorrect,
because that is the name of the organization, which also includes other
projects.

Selecting the utils to include

Not all utils are available on all platforms. To get the full set of utils for a
particular platform, you must enable the feature flag corresponding to the platform name.
For example, on Unix-like system, use --features unix and --features windows
on Windows.

For a more fine-grained selection, you can enable just the features with the
name of the utils you want to include and disable the default feature set.

Additionally, support for SELinux must be explicitly enabled with the
feat_selinux feature.

We recommend including all the utilities that a platform supports.

Compilation parameters

There are several compile-time flags that allow you to tune the coreutils to
your particular needs. Some distributions, for example, might choose to
minimize the binary size as much as possible.

This can be achieved by customizing the configuration passed to cargo. You can
view the full documentation in the
cargo documentation.

We provide three release profiles out of the box, though you may want to tweak
them:

  • release: The profile with all performance optimization enabled.
  • release-small: Optimize binary size.

They include panic abort which removes stack traces on old rust [https://blog.rust-lang.org/2025/12/11/Rust-1.92.0/].
For the precise definition of these profiles, you can look at the root
Cargo.toml.

The profiles above are just examples. We encourage package maintainers to decide
for themselves what the best parameters for their distribution are. For example,
a distribution focused on embedded systems would probably choose
release-small, but another distribution focused on security might enable
bounds checks.

It is also possible to split the debuginfo into a separate package. See the
split-debuginfo
option in cargo.

Additional artifacts

This project supports automatically generating manpages and shell completion
files which you may want to include in the package. See the page on
building from source for how to generate these.

2. Official Technical Reference & Guides (uutils/uutils.github.io)

coreutils documentations

This repository generates the user and dev documentations of https://github.com/uutils/coreutils

User documentation

It is available on:
https://uutils.org/coreutils/docs/

Can be generated with:

bash
cargo run --bin uudoc --all-features
cd docs
mdbook build

Playground

An in-browser playground runs the uutils coreutils WASM build directly in your browser:
https://uutils.org/playground/

See also how it works: https://uutils.org/playground-how-it-works/

Developer documentation:

It is available on:
https://uutils.org/dev/coreutils/

Can be generated with:

bash
cargo doc --no-deps --all-features --workspace

The website CI builds this on each main/scheduled run and publishes it
under /dev/coreutils/ (and /dev/findutils/) as part of the deploy.

Build timing

Generated by cargo, the build timings can be seen on:
https://uutils.org/cargo-timings/cargo-timing.html