Files
uutils.github.io/coreutils/index.html
T
2023-08-20 06:05:42 +00:00

313 lines
16 KiB
HTML

<!DOCTYPE html>
<html lang="en" id="oranda" class="light">
<head>
<title>uutils coreutils</title>
<meta property="og:url" content="https://github.com/uutils/coreutils" />
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="coreutils ~ GNU coreutils (updated); implemented as universal (cross-platform) utils, written in Rust" />
<meta property="og:description" content="coreutils ~ GNU coreutils (updated); implemented as universal (cross-platform) utils, written in Rust" />
<meta property="og:type" content="website" />
<meta property="og:title" content="uutils coreutils" />
<meta http-equiv="Permissions-Policy" content="interest-cohort=()" />
<link rel="stylesheet" href="/oranda-v0.3.1.css" />
<link rel="stylesheet" href="/custom.css" />
</head>
<body>
<div class="container">
<div class="page-body">
<div class="repo_banner">
<a href="https://github.com/uutils/coreutils">
<div class="github-icon" aria-hidden="true"></div>
Check out our GitHub!
</a>
</div>
<main>
<header>
<img src="/logo.svg" alt="uutils coreutils" class="logo" />
<h1 class="title">uutils coreutils</h1>
<nav class="nav">
<ul>
<li><a href="/">Home</a></li>
<li><a href="/book/">Docs</a></li>
<li><a href="/funding/">Funding</a></li>
<li><a href="/changelog/">Changelog</a></li>
</ul>
</nav>
</header>
<div class="oranda-hide">
<div>
<p><img src="docs/src/logo.svg" alt="uutils logo"></p>
<h1>uutils coreutils</h1>
<p><a href="https://crates.io/crates/coreutils" rel="noopener noreferrer"><img src="https://img.shields.io/crates/v/coreutils.svg" alt="Crates.io"></a>
<a href="https://discord.gg/wQVJbvJ" rel="noopener noreferrer"><img src="https://img.shields.io/badge/discord-join-7289DA.svg?logo=discord&amp;longCache=true&amp;style=flat" alt="Discord"></a>
<a href="https://github.com/uutils/coreutils/blob/main/LICENSE" rel="noopener noreferrer"><img src="http://img.shields.io/badge/license-MIT-blue.svg" alt="License"></a>
<a href="https://deps.rs/repo/github/uutils/coreutils" rel="noopener noreferrer"><img src="https://deps.rs/repo/github/uutils/coreutils/status.svg" alt="dependency status"></a></p>
<p><a href="https://codecov.io/gh/uutils/coreutils" rel="noopener noreferrer"><img src="https://codecov.io/gh/uutils/coreutils/branch/master/graph/badge.svg" alt="CodeCov"></a>
<img src="https://img.shields.io/badge/MSRV-1.64.0-brightgreen" alt="MSRV"></p>
</div>
<hr>
</div>
<p>uutils coreutils is a cross-platform reimplementation of the GNU coreutils in
<a href="http://www.rust-lang.org" rel="noopener noreferrer">Rust</a>. While all programs have been implemented, some
options might be missing or different behavior might be experienced.</p>
<div class="oranda-hide">
<p>To install it:</p>
<pre style="background-color:#263238;"><span style="color:#82aaff;">cargo install coreutils
</span><span style="font-style:italic;color:#ff5370;">~</span><span style="color:#82aaff;">/.cargo/bin/coreutils
</span></pre>
</div>
<h2>Goals</h2>
<p>uutils aims to be a drop-in replacement for the GNU utils. Differences with GNU
are treated as bugs.</p>
<p>uutils aims to work on as many platforms as possible, to be able to use the same
utils on Linux, Mac, Windows and other platforms. This ensures, for example,
that scripts can be easily transferred between platforms.</p>
<div class="oranda-hide">
<h2>Documentation</h2>
<p>uutils has both user and developer documentation available:</p>
<ul>
<li><a href="https://uutils.github.io/user/" rel="noopener noreferrer">User Manual</a></li>
<li><a href="https://uutils.github.io/dev/coreutils/" rel="noopener noreferrer">Developer Documentation</a></li>
</ul>
<p>Both can also be generated locally, the instructions for that can be found in
the <a href="https://github.com/uutils/uutils.github.io" rel="noopener noreferrer">coreutils docs</a> repository.</p>
<h2>Requirements</h2>
<ul>
<li>Rust (<code>cargo</code>, <code>rustc</code>)</li>
<li>GNU Make (optional)</li>
</ul>
<h3>Rust Version</h3>
<p>uutils follows Rust's release channels and is tested against stable, beta and
nightly. The current Minimum Supported Rust Version (MSRV) is <code>1.64.0</code>.</p>
<h2>Building</h2>
<p>There are currently two methods to build the uutils binaries: either Cargo or
GNU Make.</p>
<blockquote>
<p>Building the full package, including all documentation, requires both Cargo
and Gnu Make on a Unix platform.</p>
</blockquote>
<p>For either method, we first need to fetch the repository:</p>
<pre style="background-color:#263238;"><span style="color:#82aaff;">git clone https://github.com/uutils/coreutils
</span><span style="color:#82aaff;">cd coreutils
</span></pre>
<h3>Cargo</h3>
<p>Building uutils using Cargo is easy because the process is the same as for every
other Rust program:</p>
<pre style="background-color:#263238;"><span style="color:#82aaff;">cargo build</span><span style="color:#89ddff;"> --</span><span style="color:#f78c6c;">release
</span></pre>
<p>This command builds the most portable common core set of uutils into a multicall
(BusyBox-type) binary, named 'coreutils', on most Rust-supported platforms.</p>
<p>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:</p>
<pre style="background-color:#263238;"><span style="color:#82aaff;">cargo build</span><span style="color:#89ddff;"> --</span><span style="color:#f78c6c;">release</span><span style="color:#89ddff;"> --</span><span style="color:#f78c6c;">features</span><span style="color:#82aaff;"> macos
</span><span style="font-style:italic;color:#546e7a;"># or ...
</span><span style="color:#82aaff;">cargo build</span><span style="color:#89ddff;"> --</span><span style="color:#f78c6c;">release</span><span style="color:#89ddff;"> --</span><span style="color:#f78c6c;">features</span><span style="color:#82aaff;"> windows
</span><span style="font-style:italic;color:#546e7a;"># or ...
</span><span style="color:#82aaff;">cargo build</span><span style="color:#89ddff;"> --</span><span style="color:#f78c6c;">release</span><span style="color:#89ddff;"> --</span><span style="color:#f78c6c;">features</span><span style="color:#82aaff;"> unix
</span></pre>
<p>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:</p>
<pre style="background-color:#263238;"><span style="color:#82aaff;">cargo build</span><span style="color:#89ddff;"> --</span><span style="color:#f78c6c;">features </span><span style="color:#89ddff;">"</span><span style="color:#c3e88d;">base32 cat echo rm</span><span style="color:#89ddff;">" --</span><span style="color:#f78c6c;">no-default-features
</span></pre>
<p>If 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 <code>--package</code> [aka <code>-p</code>] option). For example:</p>
<pre style="background-color:#263238;"><span style="color:#82aaff;">cargo build</span><span style="color:#89ddff;"> -</span><span style="color:#f78c6c;">p</span><span style="color:#82aaff;"> uu_base32</span><span style="color:#89ddff;"> -</span><span style="color:#f78c6c;">p</span><span style="color:#82aaff;"> uu_cat</span><span style="color:#89ddff;"> -</span><span style="color:#f78c6c;">p</span><span style="color:#82aaff;"> uu_echo</span><span style="color:#89ddff;"> -</span><span style="color:#f78c6c;">p</span><span style="color:#82aaff;"> uu_rm
</span></pre>
<h3>GNU Make</h3>
<p>Building using <code>make</code> is a simple process as well.</p>
<p>To simply build all available utilities:</p>
<pre style="background-color:#263238;"><span style="color:#82aaff;">make
</span></pre>
<p>In release mode:</p>
<pre style="background-color:#263238;"><span style="color:#82aaff;">make PROFILE=release
</span></pre>
<p>To build all but a few of the available utilities:</p>
<pre style="background-color:#263238;"><span style="color:#82aaff;">make SKIP_UTILS=</span><span style="color:#89ddff;">'</span><span style="color:#c3e88d;">UTILITY_1 UTILITY_2</span><span style="color:#89ddff;">'
</span></pre>
<p>To build only a few of the available utilities:</p>
<pre style="background-color:#263238;"><span style="color:#82aaff;">make UTILS=</span><span style="color:#89ddff;">'</span><span style="color:#c3e88d;">UTILITY_1 UTILITY_2</span><span style="color:#89ddff;">'
</span></pre>
<h2>Installation</h2>
<h3>Install with Cargo</h3>
<p>Likewise, installing can simply be done using:</p>
<pre style="background-color:#263238;"><span style="color:#82aaff;">cargo install</span><span style="color:#89ddff;"> --</span><span style="color:#f78c6c;">path</span><span style="color:#82aaff;"> .</span><span style="color:#89ddff;"> --</span><span style="color:#f78c6c;">locked
</span></pre>
<p>This command will install uutils into Cargo's <em>bin</em> folder (<em>e.g.</em>
<code>$HOME/.cargo/bin</code>).</p>
<p>This does not install files necessary for shell completion or manpages. For
manpages or shell completion to work, use <code>GNU Make</code> or see
<code>Manually install shell completions</code>/<code>Manually install manpages</code>.</p>
<h3>Install with GNU Make</h3>
<p>To install all available utilities:</p>
<pre style="background-color:#263238;"><span style="color:#82aaff;">make install
</span></pre>
<p>To install using <code>sudo</code> switch <code>-E</code> must be used:</p>
<pre style="background-color:#263238;"><span style="color:#82aaff;">sudo</span><span style="color:#89ddff;"> -</span><span style="color:#f78c6c;">E</span><span style="color:#82aaff;"> make install
</span></pre>
<p>To install all but a few of the available utilities:</p>
<pre style="background-color:#263238;"><span style="color:#82aaff;">make SKIP_UTILS=</span><span style="color:#89ddff;">'</span><span style="color:#c3e88d;">UTILITY_1 UTILITY_2</span><span style="color:#89ddff;">'</span><span style="color:#82aaff;"> install
</span></pre>
<p>To install only a few of the available utilities:</p>
<pre style="background-color:#263238;"><span style="color:#82aaff;">make UTILS=</span><span style="color:#89ddff;">'</span><span style="color:#c3e88d;">UTILITY_1 UTILITY_2</span><span style="color:#89ddff;">'</span><span style="color:#82aaff;"> install
</span></pre>
<p>To install every program with a prefix (e.g. uu-echo uu-cat):</p>
<pre style="background-color:#263238;"><span style="color:#82aaff;">make PROG_PREFIX=PREFIX_GOES_HERE install
</span></pre>
<p>To install the multicall binary:</p>
<pre style="background-color:#263238;"><span style="color:#82aaff;">make MULTICALL=y install
</span></pre>
<p>Set install parent directory (default value is /usr/local):</p>
<pre style="background-color:#263238;"><span style="font-style:italic;color:#546e7a;"># DESTDIR is also supported
</span><span style="color:#82aaff;">make PREFIX=/my/path install
</span></pre>
<p>Installing with <code>make</code> installs shell completions for all installed utilities
for <code>bash</code>, <code>fish</code> and <code>zsh</code>. Completions for <code>elvish</code> and <code>powershell</code> can also
be generated; See <code>Manually install shell completions</code>.</p>
<h3>Manually install shell completions</h3>
<p>The <code>coreutils</code> binary can generate completions for the <code>bash</code>, <code>elvish</code>,
<code>fish</code>, <code>powershell</code> and <code>zsh</code> shells. It prints the result to stdout.</p>
<p>The syntax is:</p>
<pre style="background-color:#263238;"><span style="color:#82aaff;">cargo run completion </span><span style="color:#89ddff;">&lt;</span><span style="color:#82aaff;">utility</span><span style="color:#89ddff;">&gt; &lt;</span><span style="color:#82aaff;">shell</span><span style="color:#89ddff;">&gt;
</span></pre>
<p>So, to install completions for <code>ls</code> on <code>bash</code> to
<code>/usr/local/share/bash-completion/completions/ls</code>, run:</p>
<pre style="background-color:#263238;"><span style="color:#82aaff;">cargo run completion ls bash </span><span style="color:#89ddff;">&gt;</span><span style="color:#82aaff;"> /usr/local/share/bash-completion/completions/ls
</span></pre>
<h3>Manually install manpages</h3>
<p>To generate manpages, the syntax is:</p>
<pre style="background-color:#263238;"><span style="color:#82aaff;">cargo run manpage </span><span style="color:#89ddff;">&lt;</span><span style="color:#82aaff;">utility</span><span style="color:#89ddff;">&gt;
</span></pre>
<p>So, to install the manpage for <code>ls</code> to <code>/usr/local/share/man/man1/ls.1</code> run:</p>
<pre style="background-color:#263238;"><span style="color:#82aaff;">cargo run manpage ls </span><span style="color:#89ddff;">&gt;</span><span style="color:#82aaff;"> /usr/local/share/man/man1/ls.1
</span></pre>
<h2>Un-installation</h2>
<p>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.</p>
<h3>Uninstall with Cargo</h3>
<p>To uninstall uutils:</p>
<pre style="background-color:#263238;"><span style="color:#82aaff;">cargo uninstall uutils
</span></pre>
<h3>Uninstall with GNU Make</h3>
<p>To uninstall all utilities:</p>
<pre style="background-color:#263238;"><span style="color:#82aaff;">make uninstall
</span></pre>
<p>To uninstall every program with a set prefix:</p>
<pre style="background-color:#263238;"><span style="color:#82aaff;">make PROG_PREFIX=PREFIX_GOES_HERE uninstall
</span></pre>
<p>To uninstall the multicall binary:</p>
<pre style="background-color:#263238;"><span style="color:#82aaff;">make MULTICALL=y uninstall
</span></pre>
<p>To uninstall from a custom parent directory:</p>
<pre style="background-color:#263238;"><span style="font-style:italic;color:#546e7a;"># DESTDIR is also supported
</span><span style="color:#82aaff;">make PREFIX=/my/path uninstall
</span></pre>
<h2>GNU test suite compatibility</h2>
<p>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
<a href="https://uutils.github.io/user/test_coverage.html" rel="noopener noreferrer">in the user manual</a>.</p>
<p>See <a href="https://github.com/uutils/coreutils/issues/3336" rel="noopener noreferrer">https://github.com/uutils/coreutils/issues/3336</a> for the main meta bugs
(many are missing).</p>
<p><img src="https://github.com/uutils/coreutils-tracking/blob/main/gnu-results.png?raw=true" alt="Evolution over time"></p>
</div>
<h2>Contributing</h2>
<p>To contribute to uutils, please see <a href="CONTRIBUTING.md" rel="noopener noreferrer">CONTRIBUTING</a>.</p>
<h2>License</h2>
<p>uutils is licensed under the MIT License - see the <code>LICENSE</code> file for details</p>
<p>GNU Coreutils is licensed under the GPL 3.0 or later.</p>
</main>
</div>
<footer>
<a href="https://github.com/uutils/coreutils"><div class="github-icon" aria-hidden="true"></div></a>
<span>
uutils coreutils, MIT
</span>
</footer>
</div>
</body>
</html>