uutils is an attempt at writing universal (as in cross-platform) CLI utilities in Rust. This repository is intended to aggregate GNU coreutils rewrites.
Many GNU, Linux and other utilities are useful, and obviously some effort has been spent in the past to port them to Windows. However, those projects are written in platform-specific C, a language considered unsafe compared to Rust, and have other issues.
Rust provides a good, platform-agnostic way of writing systems utilities that are easy to compile anywhere, and this is as good a way as any to try and learn it.
- Rust (
cargo,rustc) - GNU Make (required to build documentation)
- Sphinx (for documentation)
- gzip (for installing documentation)
uutils follows Rust's release channels and is tested against stable, beta and nightly.
The current oldest supported version of the Rust compiler is 1.47.
On both Windows and Redox, only the nightly version is tested currently.
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 coreutilsBuilding uutils using Cargo is easy because the process is the same as for every other Rust program:
$ cargo build --releaseThis 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 unixIf 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-featuresIf you don't want to build the multicall binary and would prefer to build
the utilities as individual binaries, that is also possible. Each utility
is contained in its own package within the main repository, named
"uu_UTILNAME". To build individual utilities, use cargo to build just the
specific packages (using the --package [aka -p] option). For example:
$ cargo build -p uu_base32 -p uu_cat -p uu_echo -p uu_rmBuilding using make is a simple process as well.
To simply build all available utilities:
$ makeTo 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'Likewise, installing can simply be done using:
$ cargo install --path .This command will install uutils into Cargo's bin folder (e.g. $HOME/.cargo/bin).
This does not install files necessary for shell completion. For shell completion to work,
use GNU Make or see Manually install shell completions.
To install all available utilities:
$ make installTo install using sudo switch -E must be used:
$ sudo -E make installTo install all but a few of the available utilities:
$ make SKIP_UTILS='UTILITY_1 UTILITY_2' installTo install only a few of the available utilities:
$ make UTILS='UTILITY_1 UTILITY_2' installTo install every program with a prefix (e.g. uu-echo uu-cat):
$ make PROG_PREFIX=PREFIX_GOES_HERE installTo install the multicall binary:
$ make MULTICALL=y installSet install parent directory (default value is /usr/local):
# DESTDIR is also supported
$ make PREFIX=/my/path installInstalling 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.
The standard package set of NixOS provides this package out of the box since 18.03:
$ nix-env -iA nixos.uutils-coreutilsThe coreutils binary can generate completions for the bash, elvish, fish, powershell
and zsh shells. It prints the result to stdout.
The syntax is:
cargo run completion <utility> <shell>So, to install completions for ls on bash to /usr/local/share/bash-completion/completions/ls,
run:
cargo run completion ls bash > /usr/local/share/bash-completion/completions/lsUn-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.
To uninstall uutils:
$ cargo uninstall uutilsTo uninstall all utilities:
$ make uninstallTo uninstall every program with a set prefix:
$ make PROG_PREFIX=PREFIX_GOES_HERE uninstallTo uninstall the multicall binary:
$ make MULTICALL=y uninstallTo uninstall from a custom parent directory:
# DESTDIR is also supported
$ make PREFIX=/my/path uninstallTesting can be done using either Cargo or make.
Just like with building, we follow the standard procedure for testing using Cargo:
$ cargo testBy default, cargo test only runs the common programs. To run also platform
specific tests, run:
$ cargo test --features unixIf you would prefer to test a select few utilities:
$ cargo test --features "chmod mv tail" --no-default-featuresIf you also want to test the core utilities:
$ cargo test -p uucore -p coreutilsTo debug:
$ gdb --args target/debug/coreutils ls
(gdb) b ls.rs:79
(gdb) runTo simply test all available utilities:
$ make testTo test all but a few of the available utilities:
$ make SKIP_UTILS='UTILITY_1 UTILITY_2' testTo test only a few of the available utilities:
$ make UTILS='UTILITY_1 UTILITY_2' testTo include tests for unimplemented behavior:
$ make UTILS='UTILITY_1 UTILITY_2' SPEC=y testThis testing functionality is only available on *nix operating systems and
requires make.
To run busybox tests for all utilities for which busybox has tests
$ make busytestTo run busybox tests for a few of the available utilities
$ make UTILS='UTILITY_1 UTILITY_2' busytestTo pass an argument like "-v" to the busybox test runtime
$ make UTILS='UTILITY_1 UTILITY_2' RUNTEST_ARGS='-v' busytestTo run locally:
$ bash util/build-gnu.sh
$ bash util/run-gnu-test.sh
# To run a single test:
$ bash util/run-gnu-test.sh tests/touch/not-owner.sh # for exampleNote that it relies on individual utilities (not the multicall binary).
To contribute to uutils, please see CONTRIBUTING.
| Done | Semi-Done | To Do |
|---|---|---|
| arch | cp | stty |
| base32 | date | |
| base64 | dd | |
| basename | df | |
| basenc | expr | |
| cat | install | |
| chcon | join | |
| chgrp | ls | |
| chmod | more | |
| chown | numfmt | |
| chroot | od (--strings and 128-bit data types missing) |
|
| cksum | pr | |
| comm | printf | |
| csplit | sort | |
| cut | split | |
| dircolors | tac | |
| dirname | tail | |
| du | test | |
| echo | ||
| env | ||
| expand | ||
| factor | ||
| false | ||
| fmt | ||
| fold | ||
| groups | ||
| hashsum | ||
| head | ||
| hostid | ||
| hostname | ||
| id | ||
| kill | ||
| link | ||
| ln | ||
| logname | ||
| mkdir | ||
| mkfifo | ||
| mknod | ||
| mktemp | ||
| mv | ||
| nice | ||
| nl | ||
| nohup | ||
| nproc | ||
| paste | ||
| pathchk | ||
| pinky | ||
| printenv | ||
| ptx | ||
| pwd | ||
| readlink | ||
| realpath | ||
| relpath | ||
| rm | ||
| rmdir | ||
| runcon | ||
| seq | ||
| shred | ||
| shuf | ||
| sleep | ||
| stat | ||
| stdbuf | ||
| sum | ||
| sync | ||
| tee | ||
| timeout | ||
| touch | ||
| tr | ||
| true | ||
| truncate | ||
| tsort | ||
| tty | ||
| uname | ||
| unexpand | ||
| uniq | ||
| unlink | ||
| uptime | ||
| users | ||
| wc | ||
| who | ||
| whoami | ||
| yes |
This is an auto-generated table showing which binaries compile for each target-triple. Note that this does not indicate that they are fully implemented, or that the tests pass.
| ######OS###### | ###ARCH#### | arch | base32 | base64 | basename | cat | chgrp | chmod | chown | chroot | cksum | comm | cp | csplit | cut | date | df | dircolors | dirname | du | echo | env | expand | expr | factor | false | fmt | fold | groups | hashsum | head | hostid | hostname | id | install | join | kill | link | ln | logname | ls | mkdir | mkfifo | mknod | mktemp | more | mv | nice | nl | nohup | nproc | numfmt | od | paste | pathchk | pinky | printenv | printf | ptx | pwd | readlink | realpath | relpath | rm | rmdir | seq | shred | shuf | sleep | sort | split | stat | stdbuf | sum | sync | tac | tail | tee | test | timeout | touch | tr | true | truncate | tsort | tty | uname | unexpand | uniq | unlink | uptime | users | wc | who | whoami | yes |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| linux-gnu | aarch64 | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | |
| linux-gnu | i686 | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y |
| linux-gnu | powerpc64 | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | ||
| linux-gnu | riscv64gc | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| linux-gnu | x86_64 | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y |
| windows-msvc | aarch64 | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | |||||||||||||||||||||||||
| windows-gnu | i686 | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | ||||||||||||||||||||||
| windows-msvc | i686 | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | |||||||||||||||||||||||
| windows-gnu | x86_64 | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | ||||||||||||||||||||||
| windows-msvc | x86_64 | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | |||||||||||||||||||||||
| apple MacOS | aarch64 | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | |
| apple MacOS | x86_64 | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | |
| freebsd | x86_64 | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y |
| netbsd | x86_64 | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | ||||||||||||
| android | aarch64 | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | ||||||||||||||
| android | x86_64 | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | y | ||||||||||||||
| solaris | x86_64 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| wasi | wasm32 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| redox | x86_64 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fuchsia | aarch64 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fuchsia | x86_64 |
uutils is licensed under the MIT License - see the LICENSE file for details
GNU Coreutils is licensed under the GPL 3.0 or later.