Cross-platform Rust rewrite of the GNU coreutils https://uutils.github.io/
Find a file
mattsu 003f21aa58
Some checks are pending
CICD / Style/cargo-deny (push) Waiting to run
CICD / Style/deps (push) Waiting to run
CICD / Documentation/warnings (push) Waiting to run
CICD / MinRustV (push) Waiting to run
CICD / Separate Builds (push) Waiting to run
CICD / Dependencies (push) Waiting to run
CICD / Build/Makefile (push) Blocked by required conditions
CICD / Build/stable (push) Blocked by required conditions
CICD / Build/nightly (push) Blocked by required conditions
CICD / Binary sizes (push) Blocked by required conditions
CICD / Build (push) Blocked by required conditions
CICD / Tests/BusyBox test suite (push) Blocked by required conditions
CICD / Tests/Toybox test suite (push) Blocked by required conditions
CICD / Code Coverage (push) Waiting to run
CICD / Test all features separately (push) Blocked by required conditions
CICD / Build/SELinux (push) Blocked by required conditions
CICD / Build/SELinux-Stubs (Non-Linux) (push) Blocked by required conditions
CICD / Safe Traversal Security Check (push) Blocked by required conditions
GnuTests / Run GNU tests (native) (push) Waiting to run
GnuTests / Run GNU tests (SELinux) (push) Waiting to run
GnuTests / Aggregate GNU test results (push) Blocked by required conditions
Android / Test builds (push) Waiting to run
Benchmarks / Run benchmarks (CodSpeed) (push) Waiting to run
Code Quality / Style/format (push) Waiting to run
Code Quality / Style/lint (push) Waiting to run
Code Quality / Style/spelling (push) Waiting to run
Code Quality / Style/toml (push) Waiting to run
Code Quality / Style/Python (push) Waiting to run
Code Quality / Pre-commit hooks (push) Waiting to run
Devcontainer / Verify devcontainer (push) Waiting to run
FreeBSD / Style and Lint (push) Waiting to run
FreeBSD / Tests (push) Waiting to run
OpenBSD / Style and Lint (push) Waiting to run
OpenBSD / Tests (push) Waiting to run
WSL2 / Test (push) Waiting to run
fix(od):fix GNU coreutils test od float.sh (#9534)
* feat: add compact float formatting for half and bfloat16 in od

Implement trim_float_repr() to remove trailing zeros from float strings while preserving signs and exponents, and pad_float_repr() to align trimmed floats to fixed width. Update format_item_f16() and format_item_bf16() to produce compact output matching GNU od. Add regression tests for float16 and bfloat16 compact printing.

* refactor(od): format multiline format! in format_item_bf16 for readability

Reformat the format! macro call in the format_item_bf16 function in prn_float.rs
to span multiple lines, improving code readability without changing functionality.

* fix(od): preserve canonical precision for f16/bf16 float formats

Remove trimming of trailing zeros from f16 and bf16 float representations
in od output to maintain original precision and align behavior with
f32/f64 formatters, ensuring stable output across platforms. Update
corresponding tests to reflect the change in expected output.

* refactor(od): simplify float padding format and update tests

- Remove redundant `width = width` parameter from `format!` macro in `pad_float_repr`
- Add "bfloat" to spell-checker ignore list for better test coverage on bf16 format

* feat(od): trim trailing zeros in float outputs for GNU compatibility

Add `trim_trailing_zeros` function to remove trailing zeros and redundant decimal points from formatted floats, ensuring compact output matching GNU od for f16 and bf16 types. Update `format_item_f16` and `format_item_bf16` to apply trimming before padding.

* fix: preserve trailing zeros in F16 and BF16 float formats to match GNU od output

Remove the `trim_trailing_zeros` function and update `format_item_f16` and `format_item_bf16` to keep the raw formatted strings without trimming trailing zeros. This ensures consistent column widths and aligns with GNU od behavior for 16-bit float representations, preventing misalignment in output tables.

* refactor(od/prn_float): combine multiline format! into single line in format_item_f16

The format! macro call in format_item_f16 was split across multiple lines with newlines. This change consolidates it into a single line for improved code readability and consistency with similar patterns in the file, without altering the function's output or logic.

* feat(od): trim trailing zeros in half-precision and bfloat16 float outputs

- Add `trim_float_repr` function to remove unnecessary trailing zeros and padding from normalized float strings, leaving exponents unchanged.
- Update `format_item_f16` and `format_item_bf16` to apply trimming while maintaining column alignment via re-padding.
- Update test expectations to reflect the more compact float representations (e.g., "1" instead of "1.0000000").

* refactor: simplify float trimming condition in prn_float.rs

Replace `if let Some(_) = s.find('.')` with `s.find('.').is_some()` in the `trim_float_repr` function to improve code clarity and idiomatic Rust usage while maintaining the same logic for checking decimal presence=black.

* Update src/uu/od/src/prn_float.rs

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>

---------

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2025-12-01 14:09:16 +01:00
.cargo GNUmakefile: Add a value for cross-build (#9015) 2025-10-26 14:25:58 +01:00
.config create a script for automating code coverage 2025-04-07 10:19:00 +02:00
.devcontainer Update Dockerfile: Don't apt-get jq (preinstalled) 2025-11-25 15:51:29 +09:00
.github Merge pull request #9522 from oech3/no-wget 2025-11-30 14:31:43 +01:00
.vscode od: make GNU test od.pl pass (#9334) 2025-11-28 08:23:55 +01:00
docs installation.md: Ref MSYS2 package 2025-11-23 17:54:23 +09:00
fuzz feat(uucore): add shared hardware detection module 2025-11-24 12:53:58 +01:00
src fix(od):fix GNU coreutils test od float.sh (#9534) 2025-12-01 14:09:16 +01:00
tests fix(od):fix GNU coreutils test od float.sh (#9534) 2025-12-01 14:09:16 +01:00
util Merge pull request #9522 from oech3/no-wget 2025-11-30 14:31:43 +01:00
.busybox-config od: several small changes after review 2016-11-09 20:26:55 +01:00
.clippy.toml clippy: set MSRV to 1.85 2025-05-19 09:22:38 +02:00
.codecov.yml maint/CICD ~ configure CodeCov to report but "allow-failure" 2020-05-02 23:26:37 -05:00
.codespell.rc maint/dev ~ add codespell configuration 2021-05-31 07:58:13 -05:00
.editorconfig dotfiles: Add works to cspell dictionary 2025-03-26 16:49:21 +01:00
.envrc dotfiles: Add works to cspell dictionary 2025-03-26 16:49:21 +01:00
.gitignore create a script for automating code coverage 2025-04-07 10:19:00 +02:00
.markdownlint.yaml Run the markdown linter in the CI 2023-03-04 18:44:17 +01:00
.pre-commit-config.yaml Add devcontainer setup and small related fixes 2025-08-18 07:34:16 +00:00
.rustfmt.toml maint/dev ~ add *empty* rustfmt configuration prompt devs to use cargo fmt 2022-02-12 15:26:59 -06:00
build.rs Merge pull request #9153 from oech3/nognuhashsumbin 2025-11-08 23:55:49 +01:00
Cargo.lock Bump iana-time-zone & windows-core 2025-11-29 07:22:51 +01:00
Cargo.toml replace number_prefix by unit-prefix 2025-11-18 09:59:46 +01:00
CODE_OF_CONDUCT.md parent 9d5dc500e6 2023-03-04 18:43:40 +01:00
CONTRIBUTING.md doc: fix warnings from markdown linter 2025-05-18 21:08:27 +02:00
Cross.toml Cross.toml: Install tzdata in container 2025-05-29 14:00:25 +02:00
deny.toml deny.toml: remove windows-link from skip list 2025-11-29 07:25:09 +01:00
DEVELOPMENT.md Remove wget dep 2025-11-30 00:44:13 +09:00
flake.lock flake: drop flake-utils, refactor 2025-03-05 21:52:02 +01:00
flake.nix flake.nix: Add cspell 2025-05-25 17:57:18 +02:00
GNUmakefile GNUmakefile: Use .* for libstdbuf* matching 2025-11-20 15:00:42 +09:00
LICENSE update of the license file to make it generic (#5545) 2023-11-16 10:40:31 +01:00
Makefile refactor ~ (makefiles) fix spelling + add spell-checker exceptions 2021-05-31 08:23:58 -05:00
Makefile.toml Reformat TOML files with taplo 2023-06-08 09:07:19 +02:00
oranda.json website: fix changelog config 2023-08-28 10:36:01 +02:00
README.md README.md: note that separator is needed for PROG_PREFIX 2025-11-22 14:49:13 +09:00
README.package.md coreutils: Add a default readme for the packages 2024-06-30 10:52:10 +02:00
renovate.json chore(config): migrate config renovate.json 2024-10-31 15:26:47 +00:00
SECURITY.md Document the security process (#8633) 2025-09-14 13:56:20 +02:00

uutils logo

uutils coreutils

Crates.io Discord License dependency status

CodeCov MSRV Weblate


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.

To install it:

cargo install coreutils
~/.cargo/bin/coreutils

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, Windows and other platforms. This ensures, for example, that scripts can be easily transferred between platforms.

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.

Requirements

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

Rust Version

uutils follows Rust's release channels and is tested against stable, beta and nightly. The current Minimum Supported Rust Version (MSRV) is 1.85.0.

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:

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:

cargo build --release

Replace --release with --profile=release-fast or --profile=release-small to use all optimizations or save 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:

cargo build --release --features macos
# or ...
cargo build --release --features windows
# or ...
cargo build --release --features unix

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

cargo build --release --features unix,feat_selinux

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:

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

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

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:

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):

make

In release-fast mode:

make PROFILE=release-fast

To build all but a few of the available utilities:

make SKIP_UTILS='UTILITY_1 UTILITY_2'

To build only a few of the available utilities:

make UTILS='UTILITY_1 UTILITY_2'

Installation

Install with Cargo

Likewise, installing can simply be done using:

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:

make install

To install all utilities with all possible optimizations:

make PROFILE=release-fast install

To install using sudo switch -E must be used:

sudo -E make install

To install all but a few of the available utilities:

make SKIP_UTILS='UTILITY_1 UTILITY_2' install

To install only a few of the available utilities:

make UTILS='UTILITY_1 UTILITY_2' install

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

make PROG_PREFIX=uu- install

PROG_PREFIX requires separator -, _, or =.

To install the multicall binary:

make MULTICALL=y install

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

# 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:

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

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

Then use the installed binary:

uudoc completion <utility> <shell>

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

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

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

env PROG_PREFIX=uu- uudoc completion cp zsh

Manually install manpages

To generate manpages, the syntax is:

uudoc manpage <utility>

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

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:

cargo uninstall coreutils

Uninstall with GNU Make

To uninstall all utilities:

make uninstall

To uninstall every program with a set prefix:

make PROG_PREFIX=uu- uninstall

To uninstall the multicall binary:

make MULTICALL=y uninstall

To uninstall from a custom parent directory:

# 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).

Evolution over time

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.