uutils Coreutils Documentation
uutils is an attempt at writing universal (as in cross-platform) CLI utilitiesinRust. It is available for Linux, Windows, Macand other platforms.
The API reference foruucore
, the library of functions shared between variousutils, is hosted atdocs.rs.
uutils is licensed under theMIT License.
Useful links
Note: This manual is automatically generated from the source code and is awork in progress.
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 containpatches.
You can alsobuild uutils from source.
Cargo
# Linuxcargo install coreutils --features unix --locked# MacOscargo install coreutils --features macos --locked# Windowscargo install coreutils --features windows --locked
Linux
Alpine
apk update uutils-coreutils
Note: Requires the
edge
repository.
Arch
pacman -S uutils-coreutils
Debian
apt install rust-coreutils# To use it:export PATH=/usr/lib/cargo/bin/coreutils:$PATH
Fedora
dnf install uutils-coreutils# To use it:export PATH=/usr/libexec/uutils-coreutils:$PATH
Gentoo
emerge -pv sys-apps/uutils-coreutils
Manjaro
pacman -S uutils-coreutils# orpamac install uutils-coreutils
NixOS
nix-env -iA nixos.uutils-coreutils
OpenMandriva Lx
dnf install uutils-coreutils
RHEL/AlmaLinux/CENTOS Stream/Rocky Linux/EPEL 9
# Install EPEL 9 - Specific For RHEL please check codeready-builder-for-rhel-9 First then install epeldnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm -y# Install Core Utilsdnf install uutils-coreutils# To use it:export PATH=/usr/libexec/uutils-coreutils:$PATH
Ubuntu
apt install rust-coreutils# To use it:export PATH=/usr/lib/cargo/bin/coreutils:$PATH
MacOS
Homebrew
brew install uutils-coreutils
MacPorts
port install coreutils-uutils
FreeBSD
pkg install rust-coreutils
Windows
Winget
winget install uutils.coreutils
Scoop
scoop install uutils-coreutils
Alternative installers
Conda
conda install -c conda-forge uutils-coreutils
Yocto
The uutils-coreutils recipe is provided as part of the meta-openembedded yocto layer.Clonepoky andmeta-openembedded, addmeta-openembedded/meta-oe
as layer in yourbuild/conf/bblayers.conf
file,and then either callbitbake uutils-coreutils
, or usePREFERRED_PROVIDER_coreutils = "uutils-coreutils"
in yourbuild/conf/local.conf
file andthen build your usual yocto image.
Non-standard packages
coreutils-uutils
(AUR)
Cross-platform Rust rewrite of the GNU coreutils being used as actual system coreutils.
Build from source
Requirements
- Rust (
cargo
,rustc
) - GNU Make (optional)
Rust Version
uutils follows Rust's release channels and is tested against stable, beta andnightly. The current Minimum Supported Rust Version (MSRV) is1.85.0
.
Building
There are currently two methods to build the uutils binaries: either Cargo orGNU Make.
Building the full package, including all documentation, requires both Cargoand GNU Make on a Unix platform.
For either method, we first need to fetch the repository:
git clone https://github.com/uutils/coreutilscd coreutils
Cargo
Building uutils using Cargo is easy because the process is the same as for everyother Rust program:
cargo build --release
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 expandedsets of uutils for a platform (on that platform) is as simple as specifying itas a feature:
cargo build --release --features macos# or ...cargo build --release --features windows# or ...cargo build --release --features unix
If you don't want to build every utility available on your platform into thefinal binary, you can also specify which ones you want to build manually. Forexample:
cargo build --features "base32 cat echo rm" --no-default-features
If you don't want to build the multicall binary and would prefer to build theutilities as individual binaries, that is also possible. Each utility iscontained in its own package within the main repository, named "uu_UTILNAME". Tobuild individual utilities, use cargo to build just the specific packages (usingthe--package
[aka-p
] option). For example:
cargo build -p uu_base32 -p uu_cat -p uu_echo -p uu_rm
GNU Make
Building usingmake
is a simple process as well.
To simply build all available utilities:
make
In release mode:
make PROFILE=release
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'sbin folder (e.g.$HOME/.cargo/bin
).
This does not install files necessary for shell completion or manpages. Formanpages or shell completion to work, useGNU Make
or seeManually install shell completions
/Manually install manpages
.
Install with GNU Make
To install all available utilities:
make install
To install usingsudo
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=PREFIX_GOES_HERE install
To install the multicall binary:
make MULTICALL=y install
Set install parent directory (default value is /usr/local):
# DESTDIR is also supportedmake PREFIX=/my/path install
Installing withmake
installs shell completions for all installed utilitiesforbash
,fish
andzsh
. Completions forelvish
andpowershell
can alsobe generated; SeeManually install shell completions
.
To skip installation of completions and manpages:
make COMPLETIONS=n MANPAGES=n install
Manually install shell completions
Thecoreutils
binary can generate completions for thebash
,elvish
,fish
,powershell
andzsh
shells. It prints the result to stdout.
The syntax is:
cargo run completion <utility> <shell>
So, to install completions forls
onbash
to/usr/local/share/bash-completion/completions/ls
, run:
cargo run completion ls bash > /usr/local/share/bash-completion/completions/ls
Manually install manpages
To generate manpages, the syntax is:
cargo run manpage <utility>
So, to install the manpage forls
to/usr/local/share/man/man1/ls.1
run:
cargo run manpage ls > /usr/local/share/man/man1/ls.1
Un-installation
Un-installation differs depending on how you have installed uutils. If you usedCargo to install, use Cargo to uninstall. If you used GNU Make to install, useMake 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=PREFIX_GOES_HERE uninstall
To uninstall the multicall binary:
make MULTICALL=y uninstall
To uninstall from a custom parent directory:
# DESTDIR is also supportedmake PREFIX=/my/path uninstall
Platform support
uutils aims to be as "universal" as possible, meaning that we try to supportmany platforms. However, it is infeasible for us to guarantee that everyplatform works. Just like Rust itself, we therefore have multiple tiers ofplatform support, with different guarantees. We support two tiers of platforms:
- Tier 1: All applicable utils are compiled and tested in CI for theseplatforms.
- Tier 2: These platforms are supported but not actively tested. We do acceptfixes for these platforms.
Note: The tiers are dictated by our CI. We would happily accept a jobin the CI for testing more platforms, bumping those platforms to tier 1.
Platforms per tier
The platforms in tier 1 and the platforms that we test in CI are listed below.
Operating system | Tested targets |
---|---|
Linux | x86_64-unknown-linux-gnu x86_64-unknown-linux-musl arm-unknown-linux-gnueabihf i686-unknown-linux-gnu aarch64-unknown-linux-gnu |
macOS | x86_64-apple-darwin |
Windows | i686-pc-windows-msvc x86_64-pc-windows-gnu x86_64-pc-windows-msvc |
FreeBSD | x86_64-unknown-freebsd |
Android | i686-linux-android |
The platforms in tier 2 are more vague, but include:
- untested variations of the platforms above,
- Redox OS,
- and BSDs such as OpenBSD, NetBSD & DragonFlyBSD.
Utility compatibility per platform
Not all utils work on every platform. For instance,chgrp
is not supported onWindows, because Windows does not have the concept of groups. Below is a full tabledetailing which utilities are supported for the tier 1 platforms.
Note that for some utilities, not all functionality is supported on eachplatform. This is documented per utility.
util | Linux | macOS | Windows | FreeBSD | Android |
---|---|---|---|---|---|
arch | ✓ | ✓ | ✓ | ✓ | ✓ |
b2sum | ✓ | ✓ | ✓ | ✓ | ✓ |
b3sum | ✓ | ✓ | ✓ | ✓ | ✓ |
base32 | ✓ | ✓ | ✓ | ✓ | ✓ |
base64 | ✓ | ✓ | ✓ | ✓ | ✓ |
basename | ✓ | ✓ | ✓ | ✓ | ✓ |
basenc | ✓ | ✓ | ✓ | ✓ | ✓ |
cat | ✓ | ✓ | ✓ | ✓ | ✓ |
chcon | ✓ | ||||
chgrp | ✓ | ✓ | ✓ | ✓ | |
chmod | ✓ | ✓ | ✓ | ✓ | |
chown | ✓ | ✓ | ✓ | ✓ | |
chroot | ✓ | ✓ | ✓ | ✓ | |
cksum | ✓ | ✓ | ✓ | ✓ | ✓ |
comm | ✓ | ✓ | ✓ | ✓ | ✓ |
cp | ✓ | ✓ | ✓ | ✓ | ✓ |
csplit | ✓ | ✓ | ✓ | ✓ | ✓ |
cut | ✓ | ✓ | ✓ | ✓ | ✓ |
date | ✓ | ✓ | ✓ | ✓ | ✓ |
dd | ✓ | ✓ | ✓ | ✓ | ✓ |
df | ✓ | ✓ | ✓ | ✓ | ✓ |
dir | ✓ | ✓ | ✓ | ✓ | ✓ |
dircolors | ✓ | ✓ | ✓ | ✓ | ✓ |
dirname | ✓ | ✓ | ✓ | ✓ | ✓ |
du | ✓ | ✓ | ✓ | ✓ | ✓ |
echo | ✓ | ✓ | ✓ | ✓ | ✓ |
env | ✓ | ✓ | ✓ | ✓ | ✓ |
expand | ✓ | ✓ | ✓ | ✓ | ✓ |
expr | ✓ | ✓ | ✓ | ✓ | ✓ |
factor | ✓ | ✓ | ✓ | ✓ | ✓ |
false | ✓ | ✓ | ✓ | ✓ | ✓ |
fmt | ✓ | ✓ | ✓ | ✓ | ✓ |
fold | ✓ | ✓ | ✓ | ✓ | ✓ |
groups | ✓ | ✓ | ✓ | ✓ | |
hashsum | ✓ | ✓ | ✓ | ✓ | ✓ |
head | ✓ | ✓ | ✓ | ✓ | ✓ |
hostid | ✓ | ✓ | ✓ | ||
hostname | ✓ | ✓ | ✓ | ✓ | ✓ |
id | ✓ | ✓ | ✓ | ✓ | |
install | ✓ | ✓ | ✓ | ✓ | |
join | ✓ | ✓ | ✓ | ✓ | ✓ |
kill | ✓ | ✓ | ✓ | ✓ | |
link | ✓ | ✓ | ✓ | ✓ | ✓ |
ln | ✓ | ✓ | ✓ | ✓ | ✓ |
logname | ✓ | ✓ | ✓ | ✓ | |
ls | ✓ | ✓ | ✓ | ✓ | ✓ |
md5sum | ✓ | ✓ | ✓ | ✓ | ✓ |
mkdir | ✓ | ✓ | ✓ | ✓ | ✓ |
mkfifo | ✓ | ✓ | ✓ | ✓ | |
mknod | ✓ | ✓ | ✓ | ✓ | |
mktemp | ✓ | ✓ | ✓ | ✓ | ✓ |
more | ✓ | ✓ | ✓ | ✓ | ✓ |
mv | ✓ | ✓ | ✓ | ✓ | ✓ |
nice | ✓ | ✓ | ✓ | ✓ | |
nl | ✓ | ✓ | ✓ | ✓ | ✓ |
nohup | ✓ | ✓ | ✓ | ✓ | |
nproc | ✓ | ✓ | ✓ | ✓ | ✓ |
numfmt | ✓ | ✓ | ✓ | ✓ | ✓ |
od | ✓ | ✓ | ✓ | ✓ | ✓ |
paste | ✓ | ✓ | ✓ | ✓ | ✓ |
pathchk | ✓ | ✓ | ✓ | ✓ | |
pinky | ✓ | ✓ | ✓ | ||
pr | ✓ | ✓ | ✓ | ✓ | ✓ |
printenv | ✓ | ✓ | ✓ | ✓ | ✓ |
printf | ✓ | ✓ | ✓ | ✓ | ✓ |
ptx | ✓ | ✓ | ✓ | ✓ | ✓ |
pwd | ✓ | ✓ | ✓ | ✓ | ✓ |
readlink | ✓ | ✓ | ✓ | ✓ | ✓ |
realpath | ✓ | ✓ | ✓ | ✓ | ✓ |
rm | ✓ | ✓ | ✓ | ✓ | ✓ |
rmdir | ✓ | ✓ | ✓ | ✓ | ✓ |
runcon | ✓ | ||||
seq | ✓ | ✓ | ✓ | ✓ | ✓ |
sha1sum | ✓ | ✓ | ✓ | ✓ | ✓ |
sha224sum | ✓ | ✓ | ✓ | ✓ | ✓ |
sha256sum | ✓ | ✓ | ✓ | ✓ | ✓ |
sha3-224sum | ✓ | ✓ | ✓ | ✓ | ✓ |
sha3-256sum | ✓ | ✓ | ✓ | ✓ | ✓ |
sha3-384sum | ✓ | ✓ | ✓ | ✓ | ✓ |
sha3-512sum | ✓ | ✓ | ✓ | ✓ | ✓ |
sha384sum | ✓ | ✓ | ✓ | ✓ | ✓ |
sha3sum | ✓ | ✓ | ✓ | ✓ | ✓ |
sha512sum | ✓ | ✓ | ✓ | ✓ | ✓ |
shake128sum | ✓ | ✓ | ✓ | ✓ | ✓ |
shake256sum | ✓ | ✓ | ✓ | ✓ | ✓ |
shred | ✓ | ✓ | ✓ | ✓ | ✓ |
shuf | ✓ | ✓ | ✓ | ✓ | ✓ |
sleep | ✓ | ✓ | ✓ | ✓ | ✓ |
sort | ✓ | ✓ | ✓ | ✓ | ✓ |
split | ✓ | ✓ | ✓ | ✓ | ✓ |
stat | ✓ | ✓ | ✓ | ✓ | |
stdbuf | ✓ | ✓ | ✓ | ✓ | |
stty | ✓ | ✓ | ✓ | ✓ | |
sum | ✓ | ✓ | ✓ | ✓ | ✓ |
sync | ✓ | ✓ | ✓ | ✓ | ✓ |
tac | ✓ | ✓ | ✓ | ✓ | ✓ |
tail | ✓ | ✓ | ✓ | ✓ | ✓ |
tee | ✓ | ✓ | ✓ | ✓ | ✓ |
test | ✓ | ✓ | ✓ | ✓ | ✓ |
timeout | ✓ | ✓ | ✓ | ✓ | |
touch | ✓ | ✓ | ✓ | ✓ | ✓ |
tr | ✓ | ✓ | ✓ | ✓ | ✓ |
true | ✓ | ✓ | ✓ | ✓ | ✓ |
truncate | ✓ | ✓ | ✓ | ✓ | ✓ |
tsort | ✓ | ✓ | ✓ | ✓ | ✓ |
tty | ✓ | ✓ | ✓ | ✓ | |
uname | ✓ | ✓ | ✓ | ✓ | ✓ |
unexpand | ✓ | ✓ | ✓ | ✓ | ✓ |
uniq | ✓ | ✓ | ✓ | ✓ | ✓ |
unlink | ✓ | ✓ | ✓ | ✓ | ✓ |
uptime | ✓ | ✓ | ✓ | ||
users | ✓ | ✓ | ✓ | ||
vdir | ✓ | ✓ | ✓ | ✓ | ✓ |
wc | ✓ | ✓ | ✓ | ✓ | ✓ |
who | ✓ | ✓ | ✓ | ||
whoami | ✓ | ✓ | ✓ | ✓ | ✓ |
yes | ✓ | ✓ | ✓ | ✓ | ✓ |
Contributing to coreutils
Hi! Welcome to uutils/coreutils!
Thanks for wanting to contribute to this project! This document explainseverything you need to know to contribute. Before you start make sure to alsocheck out these documents:
- Our community'sCODE_OF_CONDUCT.md.
- DEVELOPMENT.md for setting up your developmentenvironment.
Now follows a very important warning:
[!WARNING]uutils is original code and cannot contain any code from GNU orother implementations. This means thatwe cannot accept any changes based onthe GNU source code. To make sure that cannot happen,you cannot link tothe GNU source code either. It is however possible to look at other implementationsunder a BSD or MIT license likeApple's implementationorOpenBSD.
Finally, feel free to join ourDiscord!
Getting Oriented
uutils is a big project consisting of many parts. Here are the most importantparts for getting started:
src/uu
: The code for all utilitiessrc/uucore
: Crate containing all the shared code betweenthe utilities.tests/by-util
: The tests for all utilities.src/bin/coreutils.rs
: Code for the multicallbinary.docs
: the documentation for the websitetests/uutests/
:Crate implementing the various functions to test uutils commands.
Each utility is defined as a separate crate. The structure of each of thesecrates is as follows:
Cargo.toml
src/main.rs
: contains only a single macro callsrc/<util name>.rs
: the actual code for the utility<util name>.md
: the documentation for the utility
We have separated repositories for crates that we maintain but also publish foruse by others:
Design Goals
We have the following goals with our development:
- Compatible: The utilities should be a drop-in replacement for the GNUcoreutils.
- Cross-platform: All utilities should run on as many of the supportedplatforms as possible.
- Reliable: The utilities should never unexpectedly fail.
- Performant: Our utilities should be written in fast idiomatic Rust. We aimto match or exceed the performance of the GNU utilities.
- Well-tested: We should have a lot of tests to be able to guaranteereliability and compatibility.
How to Help
There are several ways to help and writing code is just one of them. Reportingissues and writing documentation are just as important as writing code.
Reporting Issues
We can't fix bugs we don't know about, so good issues are super helpful! Hereare some tips for writing good issues:
- If you find a bug, make sure it's still a problem on the
main
branch. - Search through the existing issues to see whether it has already beenreported.
- Make sure to include all relevant information, such as:
- Which version of uutils did you check?
- Which version of GNU coreutils are you comparing with?
- What platform are you on?
- Provide a way to reliably reproduce the issue.
- Be as specific as possible!
Writing Documentation
There's never enough documentation. If you come across any documentation thatcould be improved, feel free to submit a PR for it!
Writing Code
If you want to submit a PR, make sure that you've discussed the solution withthe maintainers beforehand. We want to avoid situations where you put a lot ofwork into a fix that we can't merge! If there's no issue for what you're tryingto fix yet, make onebefore you start working on the PR.
Generally, we try to follow what GNU is doing in terms of options and behavior.It is recommended to look at the GNU coreutils manual(on the web,or locally usinginfo <utility>
). It is more in depth than the man pages andprovides a good description of available features and their implementationdetails. But remember, you cannot look at the GNU source code!
Also remember that we can only merge PRs which pass our test suite, followrustfmt, and do not have any warnings from clippy. SeeDEVELOPMENT.md for more information. Be sure to also readabout ourRust style.
Our Rust Style
We want uutils to be written in idiomatic Rust, so here are some guidelines tofollow. Some of these are aspirational, meaning that we don't do them correctlyeverywhere in the code. If you find violations of the advice below, feel free tosubmit a patch!
Don'tpanic!
The coreutils should be very reliable. This means that we should neverpanic!
.Therefore, you should avoid using.unwrap()
andpanic!
. Sometimes the use ofunreachable!
can be justified with a comment explaining why that code isunreachable.
Don'texit
We want uutils to be embeddable in other programs. This means that no functionin uutils should exit the program. Doing so would also lead to code with moreconfusing control flow. Avoid thereforestd::process::exit
and similarfunctions which exit the program early.
unsafe
uutils cannot be entirely safe, because we have to call out tolibc
and dosyscalls. However, we still want to limit our use ofunsafe
. We generally onlyacceptunsafe
for FFI, with very few exceptions. Note that performance is veryrarely a valid argument for usingunsafe
.
If you still need to write code withunsafe
, make sure to read theRustonomicon and annotate thecalls with// SAFETY:
comments explaining why the use ofunsafe
is sound.
Macros
Macros can be a great tool, but they are also usually hard to understand. Theyshould be used sparingly. Make sure to explore simpler options before you reachfor a solution involving macros.
str
,OsStr
&Path
Rust has many string-like types, and sometimes it's hard to choose the rightone. It's tempting to usestr
(andString
) for everything, but that is notalways the right choice for uutils, because we need to support invalid UTF-8,just like the GNU coreutils. For example, paths on Linux might not be validUTF-8! Whenever we are dealing with paths, we should therefore stick withOsStr
andPath
. Make sure that you only convert tostr
/String
if youknow that something is always valid UTF-8. If you need more operations onOsStr
, you can use thebstr
crate.
Doc-comments
We use rustdoc for our documentation, so it's best to followrustdoc's guidelines.Make sure that your documentation is not just repeating the name of thefunction, but actually giving more useful information. Rustdoc recommends thefollowing structure:
[short sentence explaining what it is][more detailed explanation][at least one code example that users can copy/paste to try it][even more advanced explanations if necessary]
Other comments
Comments should be written toexplain the code, not todescribe the code.Try to focus on explainingwhy the code is the way it is. If you feel like youhave to describe the code, that's usually a sign that you could improve thenaming of variables and functions.
If you edit a piece of code, make sure to update any comments that need tochange as a result. The only thing worse than having no comments is havingoutdated comments!
Git Etiquette
To ensure easy collaboration, we have guidelines for using Git and GitHub.
Commits
- Make small and atomic commits.
- Keep a clean history of commits.
- Write informative commit messages.
- Annotate your commit message with the component you're editing. For example:
cp: do not overwrite on with -i
oruucore: add support for FreeBSD
. - Do not unnecessarily move items around in the code. This makes the changesmuch harder to review. If you do need to move things around, do that in aseparate commit.
Commit messages
You can readthis section in the Git book to learn how to write good commitmessages.
In addition, here are a few examples for a summary line when committing touutils:
- commit for a single utility
nohup: cleanup and refactor
- commit for a utility's tests
tests/rm: test new feature
Beyond changes to an individual utility or its tests, other summary lines fornon-utility modules include:
README: add helpuucore: add new modulesuutils: add new utilitygitignore: add temporary files
PRs
- Make the titles of PRs descriptive.
- This means describing the problem you solve. For example, do not write
Fix #1234
, butls: fix version sort order
. - You can prefix the title with the utility the PR concerns.
- This means describing the problem you solve. For example, do not write
- Keep PRs small and self-contained. A set of small PRs is much more likely toget merged quickly than one large PR.
- Make sure the CI passes (up to intermittently failing tests).
- You know your code best, that's why it's best if you can solve merge conflictson your branch yourself.
- It's up to you whether you want to use
git merge main
orgit rebase main
. - Feel free to ask for help with merge conflicts.
- It's up to you whether you want to use
- You do not need to ping maintainers to request a review, but it's fine to doso if you don't get a response within a few days.
Platforms
We take pride in supporting many operating systems and architectures. Any codeyou contribute must at least compile without warnings for all platforms in theCI. However, you can use#[cfg(...)]
attributes to create platform dependentfeatures.
Tip: For Windows, Microsoft provides some images (VMWare, Hyper-V,VirtualBox and Parallels) for developmenton their official download page.
Improving the GNU compatibility
Please make sure you have installedGNU utils and prerequisites andcan execute commands described inComparing with GNU section ofDEVELOPMENT.md
The Python script./util/remaining-gnu-error.py
shows the list of failingtests in the CI.
To improve the GNU compatibility, the following process is recommended:
- Identify a test (the smaller, the better) on a program that you understand oris easy to understand. You can use the
./util/remaining-gnu-error.py
scriptto help with this decision. - Build both the GNU and Rust coreutils using:
bash util/build-gnu.sh
- Run the test with
bash util/run-gnu-test.sh <your test>
- Start to modify
<your test>
to understand what is wrong. Examples:- Add
set -v
to have the bash verbose mode - Add
echo $?
where needed - When the variable
fail
is used in the test,echo $fail
to see when thetest started to fail - Bump the content of the output (ex:
cat err
) - ...
- Add
- Or, if the test is simple, extract the relevant information to create a newtest case running both GNU & Rust implementation
- Start to modify the Rust implementation to match the expected behavior
- Add a test to make sure that we don't regress (our test suite is super quick)
Code coverage
To generate code coverage report locally please followCode coverage report section ofDEVELOPMENT.md
Other implementations
The Coreutils have different implementations, with different levels ofcompletions:
However, when reimplementing the tools/options in Rust, don't read their sourcecodes when they are using reciprocal licenses (ex: GNU GPL, GNU LGPL, etc).
Licensing
uutils is distributed under the terms of the MIT License; see theLICENSE
filefor details. This is a permissive license, which allows the software to be usedwith few restrictions.
Copyrights in the uutils project are retained by their contributors, and nocopyright assignment is required to contribute.
If you wish to add or change dependencies as part of a contribution to theproject, a tool likecargo-license
can be used to show their license details.The following types of license are acceptable:
- MIT License
- Dual- or tri-license with an MIT License option ("Apache-2.0 or MIT" is apopular combination)
- "MIT equivalent" license (2-clause BSD, 3-clause BSD, ISC)
- License less restrictive than the MIT License (CC0 1.0 Universal)
- Apache License version 2.0
Licenses we will not use:
- An ambiguous license, or no license
- Strongly reciprocal licenses (GNU GPL, GNU LGPL)
If you wish to add a reference but it doesn't meet these requirements, pleaseraise an issue to describe the dependency.
Setting up your local development environment
For contributing rules and best practices please refer toCONTRIBUTING.md
Before you start
For this guide we assume that you already have a GitHub account and havegit
and your favorite code editor or IDE installed and configured.Before you start working on coreutils, please follow these steps:
- Fork thecoreutils repository to your GitHub account.Tip: Seethis GitHub guide for more information on this step.
- Clone that fork to your local development environment:
git clone https://github.com/YOUR-GITHUB-ACCOUNT/coreutilscd coreutils
Tools
You will need the tools mentioned in this section to build and test your code changes locally.This section will explain how to install and configure these tools.We also have an extensive CI that uses these tools and will check your code before it can be merged.The next sectionTesting will explain how to run those checks locally to avoid waiting for the CI.
Rust toolchain
If you're using rustup to install and manage your Rust toolchains,clippy
andrustfmt
are usually already installed. If you are using one of the alternative methods, please make sure to install them manually. See following sub-sections for their usage:clippyrustfmt.
Tip You might also need to add 'llvm-tools' component if you are going togenerate code coverage reports locally:
rustup component add llvm-tools-preview
GNU utils and prerequisites
If you are developing on Linux, most likely you already have all/most GNU utilities and prerequisites installed.
To make sure, please check GNU coreutilsREADME-prereq.
You will need these torun uutils against the GNU test suite locally.
For MacOS and Windows platform specific setup please checkMacOS GNU utils andWindows GNU utils sections respectfully.
pre-commit hooks
A configuration forpre-commit
is provided in the repository. It allowsautomatically checking every git commit you make to ensure it compiles, andpassesclippy
andrustfmt
without warnings.
To use the provided hook:
- Install
pre-commit
- Run
pre-commit install
while in the repository directory
Your git commits will then automatically be checked. If a check fails, an errormessage will explain why, and your commit will be canceled. You can then makethe suggested changes, and rungit commit ...
again.
NOTE: On MacOS the pre-commit hooks are currently broken. There are workarounds involving switching to unstable nightly Rust and components.
clippy
cargo clippy --all-targets --all-features
Themsrv
key in the clippy configuration fileclippy.toml
is used to disablelints pertaining to newer features by specifying the minimum supported Rustversion (MSRV).
rustfmt
cargo fmt --all
cargo-deny
This project usescargo-deny todetect duplicate dependencies, checks licenses, etc. To run it locally, firstinstall it and then run with:
cargo deny --all-features check all
Markdown linter
We usemarkdownlint to lint theMarkdown files in the repository.
Spell checker
We usecspell
as spell checker for all files in the project. If you are usingVS Code, you can install thecode spell checkerextension to enable spell checking within your editor. Otherwise, you caninstallcspell separately.
If you want to make the spell checker ignore a word, you can add
#![allow(unused)]fn main() {// spell-checker:ignore word_to_ignore}
at the top of the file.
Testing
This section explains how to run our CI checks locally.Testing can be done using either Cargo ormake
.
Testing with Cargo
Just like with building, we follow the standard procedure for testing usingCargo:
cargo test
By default,cargo test
only runs the common programs. To run also platformspecific tests, run:
cargo test --features unix
If you would prefer to test a select few utilities:
cargo test --features "chmod mv tail" --no-default-features
If you also want to test the core utilities:
cargo test -p uucore -p coreutils# orcargo test --all-features -p uucore
Running the complete test suite might take a while. We usenextest inthe CI and you might want to try it out locally. It can speed up the execution time of the wholetest run significantly if the cpu has multiple cores.
cargo nextest run --features unix --no-fail-fast
To debug:
rust-gdb --args target/debug/coreutils ls(gdb) b ls.rs:79(gdb) run
Testing with GNU Make
To simply test all available utilities:
make test
To test all but a few of the available utilities:
make SKIP_UTILS='UTILITY_1 UTILITY_2' test
To test only a few of the available utilities:
make UTILS='UTILITY_1 UTILITY_2' test
To include tests for unimplemented behavior:
make UTILS='UTILITY_1 UTILITY_2' SPEC=y test
To run tests withnextest
just use the nextest target. Note you'll need toinstallnextest
first. Thenextest
target accepts thesame arguments like the defaulttest
target, so it's possible to pass arguments tonextest run
viaCARGOFLAGS
:
make CARGOFLAGS='--no-fail-fast' UTILS='UTILITY_1 UTILITY_2' nextest
Run Busybox Tests
This testing functionality is only available on *nix operating systems andrequiresmake
.
To run busybox tests for all utilities for which busybox has tests
make busytest
To run busybox tests for a few of the available utilities
make UTILS='UTILITY_1 UTILITY_2' busytest
To pass an argument like "-v" to the busybox test runtime
make UTILS='UTILITY_1 UTILITY_2' RUNTEST_ARGS='-v' busytest
Comparing with GNU
To run uutils against the GNU test suite locally, run the following commands:
bash util/build-gnu.sh# Build uutils with release optimizationsbash util/build-gnu.sh --release-buildbash util/run-gnu-test.sh# To run a single test:bash util/run-gnu-test.sh tests/touch/not-owner.sh # for example# To run several tests:bash util/run-gnu-test.sh tests/touch/not-owner.sh tests/rm/no-give-up.sh # for example# If this is a perl (.pl) test, to run in debug:DEBUG=1 bash util/run-gnu-test.sh tests/misc/sm3sum.pl
Tip: First time you runbash util/build-gnu.sh
command, it will provide instructions on how to checkout GNU coreutils repository at the correct release tag. Please follow those instructions and when done, runbash util/build-gnu.sh
command again.
Note that GNU test suite relies on individual utilities (not the multicall binary).
You also need to installquilt, a tool used to manage a stack of patches for modifying GNU tests.
On FreeBSD, you need to install packages for GNU coreutils and sed (used in shell scripts instead of system commands):
pkg install coreutils gsed
Code coverage report
Code coverage report can be generated usinggrcov.
To generategcov-based coverage report
export CARGO_INCREMENTAL=0export RUSTFLAGS="-Cinstrument-coverage -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort"export RUSTDOCFLAGS="-Cpanic=abort"cargo build <options...> # e.g., --features feat_os_unixcargo test <options...> # e.g., --features feat_os_unix test_pathchkgrcov . -s . --binary-path ./target/debug/ -t html --branch --ignore-not-existing --ignore build.rs --excl-br-line "^\s*((debug_)?assert(_eq|_ne)?\#\[derive\()" -o ./target/debug/coverage/# open target/debug/coverage/index.html in browser
if changes are not reflected in the report then runcargo clean
and run the above commands.
Tips for setting up on Mac
C Compiler and linker
On MacOS you'll need to install C compiler & linker:
xcode-select --install
MacOS GNU utils
On MacOS you will need to installHomebrew and use it to install the following Homebrew formulas:
brew install \ coreutils \ autoconf \ gettext \ wget \ texinfo \ xz \ automake \ gnu-sed \ m4 \ bison \ pre-commit \ findutils
After installing these Homebrew formulas, please make sure to add the following lines to yourzsh
orbash
rc file, i.e.~/.profile
or~/.zshrc
or~/.bashrc
...(assuming Homebrew is installed at default location/opt/homebrew
):
eval "$(/opt/homebrew/bin/brew shellenv)"export PATH="/opt/homebrew/opt/coreutils/libexec/gnubin:$PATH"export PATH="/opt/homebrew/opt/bison/bin:$PATH"export PATH="/opt/homebrew/opt/findutils/libexec/gnubin:$PATH"
Last step is to link Homebrew coreutils version oftimeout
to/usr/local/bin
(as admin user):
sudo ln -s /opt/homebrew/bin/timeout /usr/local/bin/timeout
Do not forget to either source updated rc file or restart you terminal session to update environment variables.
Tips for setting up on Windows
MSVC build tools
On Windows you'll need the MSVC build tools for Visual Studio 2013 or later.
If you are usingrustup-init.exe
to install Rust toolchain, it will guide you through the process of downloading and installing these prerequisites.
Otherwise please followthis guide.
Windows GNU utils
If you have usedGit for Windows to installgit
on you Windows system you might already have some GNU core utilities installed as part of "GNU Bash" included in Git for Windows package, but it is not a complete package.This article provides instruction on how to add more to it.
Alternatively you can installCygwin and/or useWSL2 to get access to all GNU core utilities on Windows.
Preparing a new release
- Modify
util/update-version.sh
(FROM & TO) and run it - Submit a new PR with these changes and wait for it to be merged
- Tag the new release
git tag -a X.Y.Z
andgit push --tags
- Once the CI is green, a new release will be automatically created in draft mode.Reuse this release and make sure that assets have been added.
- Write the release notes (it takes time) following previous examples
- Run
util/publish.sh --do-it
to publish the new release to crates.io
Contributor Covenant Code of Conduct
Our Pledge
We as members, contributors, and leaders pledge to make participation in ourcommunity a harassment-free experience for everyone, regardless of age, bodysize, visible or invisible disability, ethnicity, sex characteristics, genderidentity and expression, level of experience, education, socioeconomic status,nationality, personal appearance, race, religion, or sexual identityand orientation.
We pledge to act and interact in ways that contribute to an open, welcoming,diverse, inclusive, and healthy community.
Our Standards
Examples of behavior that contributes to a positive environment for ourcommunity include:
- Demonstrating empathy and kindness toward other people
- Being respectful of differing opinions, viewpoints, and experiences
- Giving and gracefully accepting constructive feedback
- Accepting responsibility and apologizing to those affected by our mistakes,and learning from the experience
- Focusing on what is best not just for us as individuals, but for theoverall community
Examples of unacceptable behavior include:
- The use of sexualized language or imagery, and sexual attention oradvances of any kind
- Trolling, insulting or derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or emailaddress, without their explicit permission
- Other conduct which could reasonably be considered inappropriate in aprofessional setting
Enforcement Responsibilities
Community leaders are responsible for clarifying and enforcing our standards ofacceptable behavior and will take appropriate and fair corrective action inresponse to any behavior that they deem inappropriate, threatening, offensive,or harmful.
Community leaders have the right and responsibility to remove, edit, or rejectcomments, commits, code, wiki edits, issues, and other contributions that arenot aligned to this Code of Conduct, and will communicate reasons for moderationdecisions when appropriate.
Scope
This Code of Conduct applies within all community spaces, and also applies whenan individual is officially representing the community in public spaces.Examples of representing our community include using an official e-mail address,posting via an official social media account, or acting as an appointedrepresentative at an online or offline event.
Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may bereported to the community leaders responsible for enforcement atsylvestre@debian.org.All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of thereporter of any incident.
Enforcement Guidelines
Community leaders will follow these Community Impact Guidelines in determiningthe consequences for any action they deem in violation of this Code of Conduct:
1. Correction
Community Impact: Use of inappropriate language or other behavior deemedunprofessional or unwelcome in the community.
Consequence: A private, written warning from community leaders, providingclarity around the nature of the violation and an explanation of why thebehavior was inappropriate. A public apology may be requested.
2. Warning
Community Impact: A violation through a single incident or seriesof actions.
Consequence: A warning with consequences for continued behavior. Nointeraction with the people involved, including unsolicited interaction withthose enforcing the Code of Conduct, for a specified period of time. Thisincludes avoiding interactions in community spaces as well as external channelslike social media. Violating these terms may lead to a temporary orpermanent ban.
3. Temporary Ban
Community Impact: A serious violation of community standards, includingsustained inappropriate behavior.
Consequence: A temporary ban from any sort of interaction or publiccommunication with the community for a specified period of time. No public orprivate interaction with the people involved, including unsolicited interactionwith those enforcing the Code of Conduct, is allowed during this period.Violating these terms may lead to a permanent ban.
4. Permanent Ban
Community Impact: Demonstrating a pattern of violation of communitystandards, including sustained inappropriate behavior, harassment of anindividual, or aggression toward or disparagement of classes of individuals.
Consequence: A permanent ban from any sort of public interaction withinthe community.
Attribution
This Code of Conduct is adapted from theContributor Covenant,version 2.0, available athttps://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
Community Impact Guidelines were inspired byMozilla's code of conductenforcement ladder.
For answers to common questions about this code of conduct, see the FAQ athttps://www.contributor-covenant.org/faq. Translations are available athttps://www.contributor-covenant.org/translations.
GNU Test Coverage
uutils is actively tested against the GNU coreutils test suite. The resultsbelow are automatically updated every day.
Coverage per category
Click on the categories to see the names of the tests. Green indicates a passingtest, yellow indicates a skipped test and red means that the test either failedor resulted in an error.
Progress over time
Extensions over GNU
Though the main goal of the project is compatibility, uutils supports a fewfeatures that are not supported by GNU coreutils. We take care not to introducefeatures that are incompatible with the GNU coreutils. Below is a list of uutilsextensions.
General
GNU coreutils provides two ways to define short options taking an argument:
$ ls -w 80$ ls -w80
We support a third way:
$ ls -w=80
env
GNUenv
allows the empty string to be used as an environment variable name.This is unsupported by uutils, and it will show a warning on any suchassignment.
env
has an additional-f
/--file
flag that canparse.env
files and set variables accordingly. This feature is adopted fromdotenv
stylepackages.
cp
cp
can display a progress bar when the-g
/--progress
flag is set.
mv
mv
can display a progress bar when the-g
/--progress
flag is set.
hashsum
This utility does not exist in GNU coreutils.hashsum
is a utility thatsupports computing the checksums with several algorithms. The flags and optionsare identical to the*sum
family of utils (sha1sum
,sha256sum
,b2sum
,etc.).
b3sum
This utility does not exist in GNU coreutils. The behavior is modeled after boththeb2sum
utility of GNU and theb3sum
utility by the BLAKE3 team andsupports the--no-names
option that does not appear in the GNU util.
more
We provide a simple implementation ofmore
, which is not part of GNUcoreutils. We do not aim for full compatibility with themore
utility fromutil-linux
. Features from more modern pagers (likeless
andbat
) aretherefore welcomed.
cut
cut
can separate fields by whitespace (Space and Tab) with-w
flag. Thisfeature is adopted fromFreeBSD.
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 preservemail headers in the input.-q
/--quick
breaks lines more quickly. And-T
/--tab-width
defines thenumber of spaces representing a tab when determining the line length.
printf
printf
uses arbitrary precision decimal numbers to parse and format floating pointnumbers. GNU coreutils useslong double
, whose actual size may bedouble precision64-bit float(e.g 32-bit arm),extended precision 80-bit float(x86(-64)), orquadruple precision 128-bit float (e.g. arm64).
Practically, this means that printing a number with a large precision will stay exact:
printf "%.48f\n" 0.10.100000000000000000000000000000000000000000000000 << uutils on all platforms0.100000000000000000001355252715606880542509316001 << GNU coreutils on x86(-64)0.100000000000000000000000000000000004814824860968 << GNU coreutils on arm640.100000000000000005551115123125782702118158340454 << GNU coreutils on armv7 (32-bit)
Hexadecimal floats
For hexadecimal float format (%a
), POSIX only states that one hexadecimal numbershould be present left of the decimal point (0xh.hhhhp±d
[1]), but does not say howmanybits should be included (between 1 and 4). On x86(-64), the first digit alwaysincludes 4 bits, so its value is always between0x8
and0xf
, while on otherarchitectures, only 1 bit is included, so the value is always0x1
.
However, the first digit will of course be0x0
if the number is zero. Also,rounding numbers may cause the first digit to be0x1
on x86(-64) (e.g.0xf.fffffffp-5
rounds to0x1.00p-1
), or0x2
on other architectures.
We chose to replicate x86-64 behavior on all platforms.
Additionally, the default precision of the hexadecimal float format (%a
withoutany 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 beperiodic in hexadecimal form (0.1 = 0xc.ccc...p-7
), so we revertto the number of digits that would be required to exactly print anextended precision 80-bit float,emulating GNU coreutils behavior on x86(-64). An 80-bit float has 64 bits in itsinteger and fractional part, so 16 hexadecimal digits are printed in total (1 digitbefore the decimal point, 15 after).
Practically, this means that the default hexadecimal floating point output isidentical to x86(-64) GNU coreutils:
printf "%a\n" 0.10xc.ccccccccccccccdp-7 << uutils on all platforms0xc.ccccccccccccccdp-7 << GNU coreutils on x86-640x1.999999999999999999999999999ap-4 << GNU coreutils on arm640x1.999999999999ap-4 << GNU coreutils on armv7 (32-bit)
Wecan print an arbitrary number of digits if a larger precision is requested,and the leading digit will still be in the0x8
-0xf
range:
printf "%.32a\n" 0.10xc.cccccccccccccccccccccccccccccccdp-7 << uutils on all platforms0xc.ccccccccccccccd00000000000000000p-7 << GNU coreutils on x86-640x1.999999999999999999999999999a0000p-4 << GNU coreutils on arm640x1.999999999999a0000000000000000000p-4 << GNU coreutils on armv7 (32-bit)
Note: The architecture-specific behavior on non-x86(-64) platforms may change inthe future.
seq
Unlike GNU coreutils,seq
always uses arbitrary precision decimal numbers, nomatter the parameters (integers, decimal numbers, positive or negative increments,format specified, etc.), so its output will be more correct than GNU coreutils forsome inputs (e.g. small fractional increments where GNU coreutils useslong double
).
The only limitation is that the position of the decimal point is stored in ai64
,so values smaller than 10**(-263) will underflow to 0, and some values largerthan 10(2**63) may overflow to infinity.
See also comments underprintf
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 numbersare parsed and compared, unlike GNU coreutils that uses platform-specific longdouble floating point numbers.
Extremely large or small values can still overflow or underflow to infinity or zero,see note inseq
.
ls
GNUls
provides two ways to use a long listing format:-l
and--format=long
. We support athird way:--long
.
GNUls --sort=VALUE
only supports special non-default sort orders.We support--sort=name
, which makes it possible to override an earlier value.
du
du
allowsbirth
andcreation
as values for the--time
argument to show the creation time. Italso provides a-v
/--verbose
flag.
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
uptime
Similar to the proc-ps implementation and unlike GNU/Coreutils,uptime
provides-s
/--since
to show since when the system is up.
base32/base64/basenc
Just like on macOS,base32/base64/basenc
provides-D
to decode data.
shred
The number of random passes is deterministic in both GNU and uutils. However, uutilsshred
computes the number of random passes in a simplified way, specificallymax(3, x / 10)
, which is very close but not identical to the number of random passes that GNU would do. This also satisfies an expectation that reasonable users might have, namely that the number of random passes increases monotonically with the number of passes overall; GNUshred
violates this assumption.
unexpand
GNUunexpand
provides--first-only
to convert only leading sequences of blanks. We support asecond way:-f
like busybox.
Using-U
/--no-utf8
, you can interpret input files as 8-bit ASCII rather than UTF-8.
expand
expand
also offers the-U
/--no-utf8
option to interpret input files as 8-bit ASCII instead of UTF-8.
Multi-call binary
uutils includes a multi-call binary from which the utils can be invoked. Thisreduces 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 whichthe regular arguments to the util can be passed.
coreutils [util] [util options]
The--help
flag will print a list of available utils.
Example
coreutils ls -l
arch
Options
Examples
Display the system's architecture:
arch
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
b2sum
Options
--binary
,-b
hashsum-help-binary-other
--check
,-c
hashsum-help-check
--tag
hashsum-help-tag
--text
,-t
hashsum-help-text-other
--quiet
,-q
hashsum-help-quiet
--status
,-s
hashsum-help-status
--strict
hashsum-help-strict
--ignore-missing
hashsum-help-ignore-missing
--warn
,-w
hashsum-help-warn
--zero
,-z
hashsum-help-zero
Examples
Calculate the BLAKE2 checksum for one or more files:
b2sum {{path/to/file1 path/to/file2 ...}}
Calculate and save the list of BLAKE2 checksums to a file:
b2sum {{path/to/file1 path/to/file2 ...}} > {{path/to/file.b2}}
Calculate a BLAKE2 checksum fromstdin
:
{{command}} | b2sum
Read a file of BLAKE2 checksums and filenames and verify all files have matching checksums:
b2sum {{[-c|--check]}} {{path/to/file.b2}}
Only show a message for missing files or when verification fails:
b2sum {{[-c|--check]}} --quiet {{path/to/file.b2}}
Only show a message when verification fails, ignoring missing files:
b2sum --ignore-missing {{[-c|--check]}} --quiet {{path/to/file.b2}}
Check a known BLAKE2 checksum of a file:
echo {{known_blake2_checksum_of_the_file}} {{path/to/file}} | b2sum {{[-c|--check]}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
b3sum
Options
--binary
,-b
hashsum-help-binary-other
--check
,-c
hashsum-help-check
--tag
hashsum-help-tag
--text
,-t
hashsum-help-text-other
--quiet
,-q
hashsum-help-quiet
--status
,-s
hashsum-help-status
--strict
hashsum-help-strict
--ignore-missing
hashsum-help-ignore-missing
--warn
,-w
hashsum-help-warn
--zero
,-z
hashsum-help-zero
--no-names
hashsum-help-no-names
Examples
Calculate the BLAKE3 checksum for one or more files:
b3sum {{path/to/file1 path/to/file2 ...}}
Calculate and save the list of BLAKE3 checksums to a file:
b3sum {{path/to/file1 path/to/file2 ...}} > {{path/to/file.b3}}
Calculate a BLAKE3 checksum fromstdin
:
{{command}} | b3sum
Read a file of BLAKE3 checksums and filenames and verify all files have matching checksums:
b3sum {{[-c|--check]}} {{path/to/file.b3}}
Only show a message for missing files or when verification fails:
b3sum {{[-c|--check]}} --quiet {{path/to/file.b3}}
Check a known BLAKE3 checksum of a file:
echo {{known_blake3_checksum_of_the_file}} {{path/to/file}} | b3sum {{[-c|--check]}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
base32
Options
--decode
,-d
,-D
base-common-help-decode
--ignore-garbage
,-i
base-common-help-ignore-garbage
--wrap=<COLS>
,-w <COLS>
base-common-help-wrap
Examples
Encode a file:
base32 {{path/to/file}}
Wrap encoded output at a specific width (0
disables wrapping):
base32 {{[-w|--wrap]}} {{0|76|...}} {{path/to/file}}
Decode a file:
base32 {{[-d|--decode]}} {{path/to/file}}
Encode fromstdin
:
{{command}} | base32
Decode fromstdin
:
{{command}} | base32 {{[-d|--decode]}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
base64
Options
--decode
,-d
,-D
base-common-help-decode
--ignore-garbage
,-i
base-common-help-ignore-garbage
--wrap=<COLS>
,-w <COLS>
base-common-help-wrap
Examples
Encode a file:
base64 {{path/to/file}}
Wrap encoded output at a specific width (0
disables wrapping):
base64 {{[-w|--wrap]}} {{0|76|...}} {{path/to/file}}
Decode a file:
base64 {{[-d|--decode]}} {{path/to/file}}
Encode fromstdin
:
{{command}} | base64
Decode fromstdin
:
{{command}} | base64 {{[-d|--decode]}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
basename
Options
--multiple
,-a
basename-help-multiple
--suffix=<SUFFIX>
,-s <SUFFIX>
basename-help-suffix
--zero
,-z
basename-help-zero
Examples
Show only the file name from a path:
basename {{path/to/file}}
Show only the rightmost directory name from a path:
basename {{path/to/directory}}
Show only the file name from a path, with a suffix removed:
basename {{path/to/file}} {{suffix}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
basenc
Options
--decode
,-d
,-D
base-common-help-decode
--ignore-garbage
,-i
base-common-help-ignore-garbage
--wrap=<COLS>
,-w <COLS>
base-common-help-wrap
--base64
basenc-help-base64
--base64url
basenc-help-base64url
--base32
basenc-help-base32
--base32hex
basenc-help-base32hex
--base16
basenc-help-base16
--base2lsbf
basenc-help-base2lsbf
--base2msbf
basenc-help-base2msbf
--z85
basenc-help-z85
Examples
Encode a file with base64 encoding:
basenc --base64 {{path/to/file}}
Decode a file with base64 encoding:
basenc {{[-d|--decode]}} --base64 {{path/to/file}}
Encode fromstdin
with base32 encoding with 42 columns:
{{command}} | basenc --base32 {{[-w|--wrap]}} 42
Encode fromstdin
with base32 encoding:
{{command}} | basenc --base32
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
cat
Options
--show-all
,-A
equivalent to -vET
--number-nonblank
,-b
number nonempty output lines, overrides -n
-e
equivalent to -vE
--show-ends
,-E
display $ at end of each line
--number
,-n
number all output lines
--squeeze-blank
,-s
suppress repeated empty output lines
-t
equivalent to -vT
--show-tabs
,-T
display TAB characters at ^I
--show-nonprinting
,-v
use ^ and M- notation, except for LF (\n) and TAB (\t)
-u
(ignored)
Examples
Print the contents of a file tostdout
:
cat {{path/to/file}}
Concatenate several files into an output file:
cat {{path/to/file1 path/to/file2 ...}} > {{path/to/output_file}}
Append several files to an output file:
cat {{path/to/file1 path/to/file2 ...}} >> {{path/to/output_file}}
Copy the contents of a file into an output file without buffering:
cat -u {{/dev/tty12}} > {{/dev/tty13}}
Writestdin
to a file:
cat - > {{path/to/file}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
chcon
Options
--help
chcon-help-help
--dereference
chcon-help-dereference
--no-dereference
,-h
chcon-help-no-dereference
--preserve-root
chcon-help-preserve-root
--no-preserve-root
chcon-help-no-preserve-root
--reference=<RFILE>
chcon-help-reference
--user=<USER>
,-u <USER>
chcon-help-user
--role=<ROLE>
,-r <ROLE>
chcon-help-role
--type=<TYPE>
,-t <TYPE>
chcon-help-type
--range=<RANGE>
,-l <RANGE>
chcon-help-range
--recursive
,-R
chcon-help-recursive
-H
chcon-help-follow-arg-dir-symlink
-L
chcon-help-follow-dir-symlinks
-P
chcon-help-no-follow-symlinks
--verbose
,-v
chcon-help-verbose
Examples
View security context of a file:
ls {{[-lZ|-l --context]}} {{path/to/file}}
Change the security context of a target file, using a reference file:
chcon --reference {{reference_file}} {{target_file}}
Change the full SELinux security context of a file:
chcon {{user}}:{{role}}:{{type}}:{{range/level}} {{filename}}
Change only the user part of SELinux security context:
chcon {{[-u|--user]}} {{user}} {{filename}}
Change only the role part of SELinux security context:
chcon {{[-r|--role]}} {{role}} {{filename}}
Change only the type part of SELinux security context:
chcon {{[-t|--type]}} {{type}} {{filename}}
Change only the range/level part of SELinux security context:
chcon {{[-l|--range]}} {{range/level}} {{filename}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
chgrp
Options
--help
chgrp-help-print-help
--changes
,-c
chgrp-help-changes
--silent
,-f
--quiet
chgrp-help-quiet
--verbose
,-v
chgrp-help-verbose
--preserve-root
chgrp-help-preserve-root
--no-preserve-root
chgrp-help-no-preserve-root
--reference=<RFILE>
chgrp-help-reference
--from=<GROUP>
chgrp-help-from
--recursive
,-R
chgrp-help-recursive
-H
if a command line argument is a symbolic link to a directory, traverse it
-L
traverse every symbolic link to a directory encountered
-P
do not traverse any symbolic links (default)
--dereference
affect the referent of each symbolic link (this is the default), rather than the symbolic link itself
--no-dereference
,-h
affect symbolic links instead of any referenced file (useful only on systems that can change the ownership of a symlink)
Examples
Change the owner group of a file/directory:
chgrp {{group}} {{path/to/file_or_directory}}
Recursively change the owner group of a directory and its contents:
chgrp {{[-R|--recursive]}} {{group}} {{path/to/directory}}
Change the owner group of a symbolic link:
chgrp {{[-h|--no-dereference]}} {{group}} {{path/to/symlink}}
Change the owner group of a file/directory to match a reference file:
chgrp --reference {{path/to/reference_file}} {{path/to/file_or_directory}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
chmod
Options
--help
chmod-help-print-help
--changes
,-c
chmod-help-changes
--quiet
,--silent
,-f
chmod-help-quiet
--verbose
,-v
chmod-help-verbose
--no-preserve-root
chmod-help-no-preserve-root
--preserve-root
chmod-help-preserve-root
--recursive
,-R
chmod-help-recursive
--reference
chmod-help-reference
-H
if a command line argument is a symbolic link to a directory, traverse it
-L
traverse every symbolic link to a directory encountered
-P
do not traverse any symbolic links (default)
--dereference
affect the referent of each symbolic link (this is the default), rather than the symbolic link itself
--no-dereference
,-h
affect symbolic links instead of any referenced file (useful only on systems that can change the ownership of a symlink)
Examples
Give the [u]ser who owns a file the right to e[x]ecute it:
chmod u+x {{path/to/file}}
Give the [u]ser rights to [r]ead and [w]rite to a file/directory:
chmod u+rw {{path/to/file_or_directory}}
Remove e[x]ecutable rights from the [g]roup:
chmod g-x {{path/to/file}}
Give [a]ll users rights to [r]ead and e[x]ecute:
chmod a+rx {{path/to/file}}
Give [o]thers (not in the file owner's group) the same rights as the [g]roup:
chmod o=g {{path/to/file}}
Remove all rights from [o]thers:
chmod o= {{path/to/file}}
Change permissions recursively giving [g]roup and [o]thers the ability to [w]rite:
chmod {{[-R|--recursive]}} g+w,o+w {{path/to/directory}}
Recursively give [a]ll users [r]ead permissions to files and e[X]ecute permissions to sub-directories within a directory:
chmod {{[-R|--recursive]}} a+rX {{path/to/directory}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
chown
Options
--help
chown-help-print-help
--changes
,-c
chown-help-changes
--from=<CURRENT_OWNER:CURRENT_GROUP>
chown-help-from
--preserve-root
chown-help-preserve-root
--no-preserve-root
chown-help-no-preserve-root
--quiet
chown-help-quiet
--recursive
,-R
chown-help-recursive
--reference=<RFILE>
chown-help-reference
--silent
,-f
--verbose
,-v
chown-help-verbose
-H
if a command line argument is a symbolic link to a directory, traverse it
-L
traverse every symbolic link to a directory encountered
-P
do not traverse any symbolic links (default)
--dereference
affect the referent of each symbolic link (this is the default), rather than the symbolic link itself
--no-dereference
,-h
affect symbolic links instead of any referenced file (useful only on systems that can change the ownership of a symlink)
Examples
Change the owner user of a file/directory:
chown {{user}} {{path/to/file_or_directory}}
Change the owner user and group of a file/directory:
chown {{user}}:{{group}} {{path/to/file_or_directory}}
Change the owner user and group to both have the nameuser
:
chown {{user}}: {{path/to/file_or_directory}}
Recursively change the owner of a directory and its contents:
chown {{[-R|--recursive]}} {{user}} {{path/to/directory}}
Change the owner of a symbolic link:
chown {{[-h|--no-dereference]}} {{user}} {{path/to/symlink}}
Change the owner of a file/directory to match a reference file:
chown --reference {{path/to/reference_file}} {{path/to/file_or_directory}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
chroot
Options
--groups=<GROUP1,GROUP2...>
chroot-help-groups
--userspec=<USER:GROUP>
chroot-help-userspec
--skip-chdir
chroot-help-skip-chdir
Examples
Run command as new root directory:
sudo chroot {{path/to/new/root}} {{command}}
Use a specific user and group:
sudo chroot --userspec {{username_or_id:group_name_or_id}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
cksum
Options
--algorithm=<ALGORITHM>
,-a <ALGORITHM>
cksum-help-algorithm
--untagged
cksum-help-untagged
--tag
cksum-help-tag
--length
,-l
cksum-help-length
--raw
cksum-help-raw
--strict
cksum-help-strict
--check
,-c
cksum-help-check
--base64
cksum-help-base64
--text
,-t
--binary
,-b
--warn
,-w
cksum-help-warn
--status
cksum-help-status
--quiet
cksum-help-quiet
--ignore-missing
cksum-help-ignore-missing
--zero
,-z
cksum-help-zero
Examples
Display a 32-bit checksum, size in bytes and filename:
cksum {{path/to/file}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
comm
Options
-1
comm-help-column-1
-2
comm-help-column-2
-3
comm-help-column-3
--output-delimiter=<STR>
comm-help-delimiter
--zero-terminated
,-z
comm-help-zero-terminated
--total
comm-help-total
--check-order
comm-help-check-order
--nocheck-order
comm-help-no-check-order
Examples
Produce three tab-separated columns: lines only in first file, lines only in second file and common lines:
comm {{file1}} {{file2}}
Print only lines common to both files:
comm -12 {{file1}} {{file2}}
Print only lines common to both files, reading one file fromstdin
:
cat {{file1}} | comm -12 - {{file2}}
Get lines only found in first file, saving the result to a third file:
comm -23 {{file1}} {{file2}} > {{file1_only}}
Print lines only found in second file, when the files aren't sorted:
comm -13 <(sort {{file1}}) <(sort {{file2}})
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
cp
Options
--target-directory=<target-directory>
,-t <target-directory>
cp-help-target-directory
--no-target-directory
,-T
cp-help-no-target-directory
--interactive
,-i
cp-help-interactive
--link
,-l
cp-help-link
--no-clobber
,-n
cp-help-no-clobber
--recursive
,-R
,-r
cp-help-recursive
--strip-trailing-slashes
cp-help-strip-trailing-slashes
--debug
cp-help-debug
--verbose
,-v
cp-help-verbose
--symbolic-link
,-s
cp-help-symbolic-link
--force
,-f
cp-help-force
--remove-destination
cp-help-remove-destination
--backup=<CONTROL>
make a backup of each existing destination file
-b
like --backup but does not accept an argument
--suffix=<SUFFIX>
,-S <SUFFIX>
override the usual backup suffix
--update
move only when the SOURCE file is newer than the destination file or when the destination file is missing
-u
like --update but does not accept an argument
--reflink=<WHEN>
cp-help-reflink
--attributes-only
cp-help-attributes-only
--preserve=<ATTR_LIST>
cp-help-preserve
--preserve-default-attributes
,-p
cp-help-preserve-default
--no-preserve=<ATTR_LIST>
cp-help-no-preserve
--parents
cp-help-parents
--no-dereference
,-P
cp-help-no-dereference
--dereference
,-L
cp-help-dereference
-H
cp-help-cli-symbolic-links
--archive
,-a
cp-help-archive
-d
cp-help-no-dereference-preserve-links
--one-file-system
,-x
cp-help-one-file-system
--sparse=<WHEN>
cp-help-sparse
-Z
cp-help-selinux
--context=<CTX>
cp-help-context
--progress
,-g
cp-help-progress
--copy-contents
cp-help-copy-contents
Examples
Copy a file to another location:
cp {{path/to/source_file.ext}} {{path/to/target_file.ext}}
Copy a file into another directory, keeping the filename:
cp {{path/to/source_file.ext}} {{path/to/target_parent_directory}}
Recursively copy a directory's contents to another location (if the destination exists, the directory is copied inside it):
cp {{[-r|--recursive]}} {{path/to/source_directory}} {{path/to/target_directory}}
Copy a directory recursively, in verbose mode (shows files as they are copied):
cp {{[-vr|--verbose --recursive]}} {{path/to/source_directory}} {{path/to/target_directory}}
Copy multiple files at once to a directory:
cp {{[-t|--target-directory]}} {{path/to/destination_directory}} {{path/to/file1 path/to/file2 ...}}
Copy all files with a specific extension to another location, in interactive mode (prompts user before overwriting):
cp {{[-i|--interactive]}} {{*.ext}} {{path/to/target_directory}}
Follow symbolic links before copying:
cp {{[-L|--dereference]}} {{link}} {{path/to/target_directory}}
Use the full path of source files, creating any missing intermediate directories when copying:
cp --parents {{source/path/to/file}} {{path/to/target_file}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
csplit
Options
--suffix-format=<FORMAT>
,-b <FORMAT>
csplit-help-suffix-format
--prefix=<PREFIX>
,-f <PREFIX>
csplit-help-prefix
--keep-files
,-k
csplit-help-keep-files
--suppress-matched
csplit-help-suppress-matched
--digits=<DIGITS>
,-n <DIGITS>
csplit-help-digits
--quiet
,--silent
,-q
,-s
csplit-help-quiet
--elide-empty-files
,-z
csplit-help-elide-empty-files
Examples
Split a file at lines 5 and 23:
csplit {{path/to/file}} 5 23
Split a file every 5 lines (this will fail if the total number of lines is not divisible by 5):
csplit {{path/to/file}} 5 {*}
Split a file every 5 lines, ignoring exact-division error:
csplit {{[-k|--keep-files]}} {{path/to/file}} 5 {*}
Split a file at line 5 and use a custom prefix for the output files:
csplit {{path/to/file}} 5 {{[-f|--prefix]}} {{prefix}}
Split a file at a line matching a regular expression:
csplit {{path/to/file}} /{{regular_expression}}/
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
cut
Options
--bytes=<LIST>
,-b <LIST>
cut-help-bytes
--characters=<LIST>
,-c <LIST>
cut-help-characters
--delimiter=<DELIM>
,-d <DELIM>
cut-help-delimiter
-w <WHITESPACE>
cut-help-whitespace-delimited
--fields=<LIST>
,-f <LIST>
cut-help-fields
--complement
cut-help-complement
--only-delimited
,-s
cut-help-only-delimited
--zero-terminated
,-z
cut-help-zero-terminated
--output-delimiter=<NEW_DELIM>
cut-help-output-delimiter
Examples
Print a specific [c]haracter/[f]ield range of each line:
{{command}} | cut --{{characters|fields}} {{1|1,10|1-10|1-|-10}}
Print a field range of each line with a specific delimiter:
{{command}} | cut {{[-d|--delimiter]}} "{{delimiter}}" {{[-f|--fields]}} {{1|1,10|1-10|1-|-10}}
Print a character range of each line of the specific file:
cut {{[-c|--characters]}} {{1}} {{path/to/file}}
Print specific fields ofNUL
terminated lines (e.g. as infind . -print0
) instead of newlines:
{{command}} | cut {{[-z|--zero-terminated]}} {{[-f|--fields]}} {{1}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
date
Options
--date=<STRING>
,-d <STRING>
date-help-date
--file=<DATEFILE>
,-f <DATEFILE>
date-help-file
--iso-8601=<FMT>
,-I <FMT>
date-help-iso-8601
--rfc-email
,-R
date-help-rfc-email
--rfc-3339=<FMT>
date-help-rfc-3339
--debug
date-help-debug
--reference=<FILE>
,-r <FILE>
date-help-reference
--set=<STRING>
,-s <STRING>
date-help-set
--universal
,-u
date-help-universal
Examples
Display the current date using the default locale's format:
date +%c
Display the current date in UTC, using the ISO 8601 format:
date {{[-u|--utc]}} +%Y-%m-%dT%H:%M:%S%Z
Display the current date as a Unix timestamp (seconds since the Unix epoch):
date +%s
Convert a date specified as a Unix timestamp to the default format:
date {{[-d|--date]}} @{{1473305798}}
Convert a given date to the Unix timestamp format:
date {{[-d|--date]}} "{{2018-09-01 00:00}}" +%s {{[-u|--utc]}}
Display the current date using the RFC-3339 format (YYYY-MM-DD hh:mm:ss TZ
):
date --rfc-3339 s
Set the current date using the formatMMDDhhmmYYYY.ss
(YYYY
and.ss
are optional):
date {{093023592021.59}}
Display the current ISO week number:
date +%V
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
dd
Options
Examples
Make a bootable USB drive from an isohybrid file (such asarchlinux-xxx.iso
) and show the progress:
dd if={{path/to/file.iso}} of={{/dev/usb_drive}} status=progress
Clone a drive to another drive with 4 MiB block size and flush writes before the command terminates:
dd bs=4194304 conv=fsync if={{/dev/source_drive}} of={{/dev/dest_drive}}
Generate a file with a specific number of random bytes by using kernel random driver:
dd bs={{100}} count={{1}} if=/dev/urandom of={{path/to/random_file}}
Benchmark the sequential write performance of a disk:
dd bs={{1024}} count={{1000000}} if=/dev/zero of={{path/to/file_1GB}}
Create a system backup, save it into an IMG file (can be restored later by swappingif
andof
), and show the progress:
dd if={{/dev/drive_device}} of={{path/to/file.img}} status=progress
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
df
Options
--help
df-help-print-help
--all
,-a
df-help-all
--block-size=<SIZE>
,-B <SIZE>
df-help-block-size
--total
df-help-total
--human-readable
,-h
df-help-human-readable
--si
,-H
df-help-si
--inodes
,-i
df-help-inodes
-k
df-help-kilo
--local
,-l
df-help-local
--no-sync
df-help-no-sync
--output=<FIELD_LIST>
df-help-output
--portability
,-P
df-help-portability
--sync
df-help-sync
--type=<TYPE>
,-t <TYPE>
df-help-type
--print-type
,-T
df-help-print-type
--exclude-type=<TYPE>
,-x <TYPE>
df-help-exclude-type
Examples
Display all filesystems and their disk usage using 512-byte units:
df
Display the filesystem and its disk usage containing the given file or directory:
df {{path/to/file_or_directory}}
Use 1024-byte units when writing space figures:
df -k
Display information in a portable way:
df -P
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
dir
Options
--help
ls-help-print-help
--format
ls-help-set-display-format
-C
ls-help-display-files-columns
--long
,-l
ls-help-display-detailed-info
-x
ls-help-list-entries-rows
--tabsize=<COLS>
,-T <COLS>
ls-help-assume-tab-stops
-m
ls-help-list-entries-commas
--zero
ls-help-list-entries-nul
--dired
,-D
ls-help-generate-dired-output
--hyperlink=<WHEN>
ls-help-hyperlink-filenames
-1
ls-help-list-one-file-per-line
-o
ls-help-long-format-no-group
-g
ls-help-long-no-owner
--numeric-uid-gid
,-n
ls-help-long-numeric-uid-gid
--quoting-style
ls-help-set-quoting-style
--literal
,-N
ls-help-literal-quoting-style
--escape
,-b
ls-help-escape-quoting-style
--quote-name
,-Q
ls-help-c-quoting-style
--hide-control-chars
,-q
ls-help-replace-control-chars
--show-control-chars
ls-help-show-control-chars
--time=<field>
ls-help-show-time-field
-c
ls-help-time-change
-u
ls-help-time-access
--hide=<PATTERN>
ls-help-hide-pattern
--ignore=<PATTERN>
,-I <PATTERN>
ls-help-ignore-pattern
--ignore-backups
,-B
ls-help-ignore-backups
--sort=<field>
ls-help-sort-by-field
-S
ls-help-sort-by-size
-t
ls-help-sort-by-time
-v
ls-help-sort-by-version
-X
ls-help-sort-by-extension
-U
ls-help-sort-none
--dereference
,-L
ls-help-dereference-all
--dereference-command-line-symlink-to-dir
ls-help-dereference-dir-args
--dereference-command-line
,-H
ls-help-dereference-args
--no-group
,-G
ls-help-no-group
--author
ls-help-author
--all
,-a
ls-help-all-files
--almost-all
,-A
ls-help-almost-all
--directory
,-d
ls-help-directory
--human-readable
,-h
ls-help-human-readable
--kibibytes
,-k
ls-help-kibibytes
--si
ls-help-si
--block-size=<BLOCK_SIZE>
ls-help-block-size
--inode
,-i
ls-help-print-inode
--reverse
,-r
ls-help-reverse-sort
--recursive
,-R
ls-help-recursive
--width=<COLS>
,-w <COLS>
ls-help-terminal-width
--size
,-s
ls-help-allocation-size
--color
ls-help-color-output
--indicator-style
ls-help-indicator-style
--classify=<when>
,-F <when>
ls-help-classify
--file-type
ls-help-file-type
-p
ls-help-slash-directories
--time-style=<TIME_STYLE>
ls-help-time-style
--full-time
ls-help-full-time
--context
,-Z
ls-help-context
--group-directories-first
ls-help-group-directories-first
Examples
List all files, including hidden files:
dir {{[-a|--all]}}
List files including their author (-l
is required):
dir -l --author
List files excluding those that match a specified blob pattern:
dir --hide {{pattern}}
List subdirectories recursively:
dir {{[-R|--recursive]}}
Display help:
dir --help
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
dircolors
Options
--sh
,--bourne-shell
,-b
dircolors-help-bourne-shell
--csh
,--c-shell
,-c
dircolors-help-c-shell
--print-database
,-p
dircolors-help-print-database
--print-ls-colors
dircolors-help-print-ls-colors
Examples
Output commands to set LS_COLOR using default colors:
dircolors
Display each filetype with the color they would appear inls
:
dircolors --print-ls-colors
Output commands to set LS_COLOR using colors from a file:
dircolors {{path/to/file}}
Output commands for Bourne shell:
dircolors {{[-b|--bourne-shell]}}
Output commands for C shell:
dircolors {{[-c|--c-shell]}}
View the default colors for file types and extensions:
dircolors {{[-p|--print-database]}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
dirname
Options
--zero
,-z
dirname-zero-help
Examples
Calculate the parent directory of a given path:
dirname {{path/to/file_or_directory}}
Calculate the parent directory of multiple paths:
dirname {{path/to/file_or_directory1 path/to/file_or_directory2 ...}}
Delimit output with a NUL character instead of a newline (useful when combining withxargs
):
dirname {{[-z|--zero]}} {{path/to/file_or_directory1 path/to/file_or_directory2 ...}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
du
Options
--help
du-help-print-help
--all
,-a
du-help-all
--apparent-size
du-help-apparent-size
--block-size=<SIZE>
,-B <SIZE>
du-help-block-size
--bytes
,-b
du-help-bytes
--total
,-c
du-help-total
--max-depth=<N>
,-d <N>
du-help-max-depth
--human-readable
,-h
du-help-human-readable
--inodes
du-help-inodes
-k
du-help-block-size-1k
--count-links
,-l
du-help-count-links
--dereference
,-L
du-help-dereference
--dereference-args
,-D
,-H
du-help-dereference-args
--no-dereference
,-P
du-help-no-dereference
-m
du-help-block-size-1m
--null
,-0
du-help-null
--separate-dirs
,-S
du-help-separate-dirs
--summarize
,-s
du-help-summarize
--si
du-help-si
--one-file-system
,-x
du-help-one-file-system
--threshold=<SIZE>
,-t <SIZE>
du-help-threshold
--verbose
,-v
du-help-verbose
--exclude=<PATTERN>
du-help-exclude
--exclude-from=<FILE>
,-X <FILE>
du-help-exclude-from
--files0-from=<FILE>
du-help-files0-from
--time=<WORD>
du-help-time
--time-style=<STYLE>
du-help-time-style
Examples
List the sizes of a directory and any subdirectories, in the given unit (B/KiB/MiB):
du -{{b|k|m}} {{path/to/directory}}
List the sizes of a directory and any subdirectories, in human-readable form (i.e. auto-selecting the appropriate unit for each size):
du {{[-h|--human-readable]}} {{path/to/directory}}
Show the size of a single directory, in human-readable units:
du {{[-sh|--summarize --human-readable]}} {{path/to/directory}}
List the human-readable sizes of a directory and of all the files and directories within it:
du {{[-ah|--all --human-readable]}} {{path/to/directory}}
List the human-readable sizes of a directory and any subdirectories, up to N levels deep:
du {{[-h|--human-readable]}} {{[-d|--max-depth]}} N {{path/to/directory}}
List the human-readable size of all.jpg
files in current directory, and show a cumulative total at the end:
du {{[-ch|--total --human-readable]}} {{./*.jpg}}
List all files and directories (including hidden ones) above a certain threshold size (useful for investigating what is actually taking up the space):
du {{[-ah|--all --human-readable]}} {{[-t|--threshold]}} {{1G|1024M|1048576K}} .[^.]* *
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
echo
Options
-n
echo-help-no-newline
-e
echo-help-enable-escapes
-E
echo-help-disable-escapes
Examples
Print a text message. Note: Quotes are optional:
echo "{{Hello World}}"
Print a message with environment variables:
echo "{{My path is $PATH}}"
Print a message without the trailing newline:
echo -n "{{Hello World}}"
Append a message to the file:
echo "{{Hello World}}" >> {{file.txt}}
Enable interpretation of backslash escapes (special characters):
echo -e "{{Column 1\tColumn 2}}"
Print the exit status of the last executed command (Note: In Windows Command Prompt and PowerShell the equivalent commands areecho %errorlevel%
and$lastexitcode
respectively):
echo $?
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
env
Options
--ignore-environment
,-i
env-help-ignore-environment
--chdir=<DIR>
,-C <DIR>
env-help-chdir
--null
,-0
env-help-null
--file=<PATH>
,-f <PATH>
env-help-file
--unset=<NAME>
,-u <NAME>
env-help-unset
--debug
,-v
env-help-debug
--split-string=<S>
,-S <S>
env-help-split-string
--argv0=<a>
,-a <a>
env-help-argv0
--ignore-signal=<SIG>
env-help-ignore-signal
Examples
Show the environment:
env
Run a program. Often used in scripts after the shebang (#!) for looking up the path to the program:
env {{program}}
Clear the environment and run a program:
env {{[-i|--ignore-environment]}} {{program}}
Remove variable from the environment and run a program:
env {{[-u|--unset]}} {{variable}} {{program}}
Set a variable and run a program:
env {{variable}}={{value}} {{program}}
Set one or more variables and run a program:
env {{variable1=value variable2=value variable3=value ...}} {{program}}
Run a program under a different name:
env {{[-a|--argv0]}} {{custom_name}} {{program}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
expand
Options
--initial
,-i
expand-help-initial
--tabs=<N, LIST>
,-t <N, LIST>
expand-help-tabs
--no-utf8
,-U
expand-help-no-utf8
Examples
Convert tabs in each file to spaces, writing tostdout
:
expand {{path/to/file}}
Convert tabs to spaces, reading fromstdin
:
expand
Do not convert tabs after non blanks:
expand {{[-i|--initial]}} {{path/to/file}}
Have tabs a certain number of characters apart, not 8:
expand {{[-t|--tabs]}} {{number}} {{path/to/file}}
Use a comma separated list of explicit tab positions:
expand {{[-t|--tabs]}} {{1,4,6}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
expr
Options
--version
expr-help-version
--help
expr-help-help
Examples
Get the length of a specific string:
expr length "{{string}}"
Get the substring of a string with a specific length:
expr substr "{{string}}" {{from}} {{length}}
Match a specific substring against an anchored pattern:
expr match "{{string}}" '{{pattern}}'
Get the first char position from a specific set in a string:
expr index "{{string}}" "{{chars}}"
Calculate a specific mathematic expression:
expr {{expression1}} {{+|-|*|/|%}} {{expression2}}
Get the first expression if its value is non-zero and not null otherwise get the second one:
expr {{expression1}} \| {{expression2}}
Get the first expression if both expressions are non-zero and not null otherwise get zero:
expr {{expression1}} \& {{expression2}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
factor
Options
--exponents
,-h
factor-help-exponents
--help
factor-help-help
Examples
Display the prime-factorization of a number:
factor {{number}}
Take the input fromstdin
if no argument is specified:
echo {{number}} | factor
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
false
Options
--help
false-help-text
--version
false-version-text
Examples
Return a non-zero exit code:
false
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
fmt
Options
--crown-margin
,-c
fmt-crown-margin-help
--tagged-paragraph
,-t
fmt-tagged-paragraph-help
--preserve-headers
,-m
fmt-preserve-headers-help
--split-only
,-s
fmt-split-only-help
--uniform-spacing
,-u
fmt-uniform-spacing-help
--prefix=<PREFIX>
,-p <PREFIX>
fmt-prefix-help
--skip-prefix=<PSKIP>
,-P <PSKIP>
fmt-skip-prefix-help
--exact-prefix
,-x
fmt-exact-prefix-help
--exact-skip-prefix
,-X
fmt-exact-skip-prefix-help
--width=<WIDTH>
,-w <WIDTH>
fmt-width-help
--goal=<GOAL>
,-g <GOAL>
fmt-goal-help
--quick
,-q
fmt-quick-help
--tab-width=<TABWIDTH>
,-T <TABWIDTH>
fmt-tab-width-help
Examples
Reformat a file:
fmt {{path/to/file}}
Reformat a file producing output lines of (at most)n
characters:
fmt {{[-w|--width]}} {{n}} {{path/to/file}}
Reformat a file without joining lines shorter than the given width together:
fmt {{[-s|--split-only]}} {{path/to/file}}
Reformat a file with uniform spacing (1 space between words and 2 spaces between paragraphs):
fmt {{[-u|--uniform-spacing]}} {{path/to/file}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
fold
Options
--bytes
,-b
fold-bytes-help
--spaces
,-s
fold-spaces-help
--width=<WIDTH>
,-w <WIDTH>
fold-width-help
Examples
Wrap each line to default width (80 characters):
fold {{path/to/file}}
Wrap each line to width "30":
fold -w30 {{path/to/file}}
Wrap each line to width "5" and break the line at spaces (puts each space separated word in a new line, words with length > 5 are wrapped):
fold -w5 -s {{path/to/file}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
groups
Options
Examples
Print group memberships for the current user:
groups
Print group memberships for a list of users:
groups {{username1 username2 ...}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
hashsum
Options
--binary
,-b
hashsum-help-binary-other
--check
,-c
hashsum-help-check
--tag
hashsum-help-tag
--text
,-t
hashsum-help-text-other
--quiet
,-q
hashsum-help-quiet
--status
,-s
hashsum-help-status
--strict
hashsum-help-strict
--ignore-missing
hashsum-help-ignore-missing
--warn
,-w
hashsum-help-warn
--zero
,-z
hashsum-help-zero
--bits=<BITS>
hashsum-help-bits
--no-names
hashsum-help-no-names
--md5
hashsum-help-md5
--sha1
hashsum-help-sha1
--sha224
hashsum-help-sha224
--sha256
hashsum-help-sha256
--sha384
hashsum-help-sha384
--sha512
hashsum-help-sha512
--sha3
hashsum-help-sha3
--sha3-224
hashsum-help-sha3-224
--sha3-256
hashsum-help-sha3-256
--sha3-384
hashsum-help-sha3-384
--sha3-512
hashsum-help-sha3-512
--shake128
hashsum-help-shake128
--shake256
hashsum-help-shake256
--b2sum
hashsum-help-b2sum
--b3sum
hashsum-help-b3sum
head
Options
--bytes=<[-]NUM>
,-c <[-]NUM>
head-help-bytes
--lines=<[-]NUM>
,-n <[-]NUM>
head-help-lines
--quiet
,--silent
,-q
head-help-quiet
--verbose
,-v
head-help-verbose
--presume-input-pipe
--zero-terminated
,-z
head-help-zero-terminated
Examples
Output the first few lines of a file:
head -n {{count}} {{path/to/file}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
hostid
Options
Examples
Display the numeric identifier for the current host in hexadecimal:
hostid
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
hostname
Options
--domain
,-d
hostname-help-domain
--ip-address
,-i
hostname-help-ip-address
--fqdn
,-f
hostname-help-fqdn
--short
,-s
hostname-help-short
Examples
Show current host name:
hostname
Show the network address of the host name:
hostname {{[-i|--ip-address]}}
Show the FQDN (Fully Qualified Domain Name):
hostname {{[-f|--fqdn]}}
Set current host name:
hostname {{new_hostname}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
id
Options
-A
id-help-audit
--user
,-u
id-help-user
--group
,-g
id-help-group
--groups
,-G
id-help-groups
-p
id-help-human-readable
--name
,-n
id-help-name
-P
id-help-password
--real
,-r
id-help-real
--zero
,-z
id-help-zero
--context
,-Z
id-context-help-enabled
Examples
Display current user's ID (UID), group ID (GID) and groups to which they belong:
id
Display the current user identity:
id {{[-un|--user --name]}}
Display the current user identity as a number:
id {{[-u|--user]}}
Display the current primary group identity:
id {{[-gn|--group --name]}}
Display the current primary group identity as a number:
id {{[-g|--group]}}
Display an arbitrary user's ID (UID), group ID (GID) and groups to which they belong:
id {{username}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
install
Options
--backup=<CONTROL>
make a backup of each existing destination file
-b
like --backup but does not accept an argument
-c
install-help-ignored
--compare
,-C
install-help-compare
--directory
,-d
install-help-directory
-D
install-help-create-leading
--group=<GROUP>
,-g <GROUP>
install-help-group
--mode=<MODE>
,-m <MODE>
install-help-mode
--owner=<OWNER>
,-o <OWNER>
install-help-owner
--preserve-timestamps
,-p
install-help-preserve-timestamps
--strip
,-s
install-help-strip
--strip-program=<PROGRAM>
install-help-strip-program
--suffix=<SUFFIX>
,-S <SUFFIX>
override the usual backup suffix
--target-directory=<DIRECTORY>
,-t <DIRECTORY>
install-help-target-directory
--no-target-directory
,-T
install-help-no-target-directory
--verbose
,-v
install-help-verbose
--preserve-context
,-P
install-help-preserve-context
--context=<CONTEXT>
,-Z <CONTEXT>
install-help-context
Examples
Copy files to the destination:
install {{path/to/source_file1 path/to/source_file2 ...}} {{path/to/destination}}
Copy files to the destination, setting their ownership:
install {{[-o|--owner]}} {{user}} {{path/to/source_file1 path/to/source_file2 ...}} {{path/to/destination}}
Copy files to the destination, setting their group ownership:
install {{[-g|--group]}} {{user}} {{path/to/source_file1 path/to/source_file2 ...}} {{path/to/destination}}
Copy files to the destination, setting theirmode
:
install {{[-m|--mode]}} {{+x}} {{path/to/source_file1 path/to/source_file2 ...}} {{path/to/destination}}
Copy files and apply access/modification times of source to the destination:
install {{[-p|--preserve-timestamps]}} {{path/to/source_file1 path/to/source_file2 ...}} {{path/to/destination}}
Copy files and create the directories at the destination if they don't exist:
install -D {{path/to/source_file1 path/to/source_file2 ...}} {{path/to/destination}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
join
Options
-a <FILENUM>
join-help-a
-v <FILENUM>
join-help-v
-e <EMPTY>
join-help-e
--ignore-case
,-i
join-help-i
-j <FIELD>
join-help-j
-o <FORMAT>
join-help-o
-t <CHAR>
join-help-t
-1 <FIELD>
join-help-1
-2 <FIELD>
join-help-2
--check-order
join-help-check-order
--nocheck-order
join-help-nocheck-order
--header
join-help-header
--zero-terminated
,-z
join-help-z
Examples
Join two files on the first (default) field:
join {{path/to/file1}} {{path/to/file2}}
Join two files using a comma (instead of a space) as the field separator:
join -t {{','}} {{path/to/file1}} {{path/to/file2}}
Join field3 of file1 with field1 of file2:
join -1 {{3}} -2 {{1}} {{path/to/file1}} {{path/to/file2}}
Produce a line for each unpairable line for file1:
join -a {{1}} {{path/to/file1}} {{path/to/file2}}
Join a file fromstdin
:
cat {{path/to/file1}} | join - {{path/to/file2}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
kill
Options
--list
,-l
kill-help-list
--table
,-t
kill-help-table
--signal=<signal>
,-s <signal>
kill-help-signal
Examples
Terminate a program using the default SIGTERM (terminate) signal:
kill {{process_id}}
List available signal names (to be used without theSIG
prefix):
kill -l
Terminate a program using the SIGHUP (hang up) signal. Many daemons will reload instead of terminating:
kill -{{1|HUP}} {{process_id}}
Terminate a program using the SIGINT (interrupt) signal. This is typically initiated by the user pressing<Ctrl c>
:
kill -{{2|INT}} {{process_id}}
Signal the operating system to immediately terminate a program (which gets no chance to capture the signal):
kill -{{9|KILL}} {{process_id}}
Signal the operating system to pause a program until a SIGCONT ("continue") signal is received:
kill -{{17|STOP}} {{process_id}}
Send aSIGUSR1
signal to all processes with the given GID (group id):
kill -{{SIGUSR1}} -{{group_id}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
link
Options
Examples
Create a hard link from a new file to an existing file:
link {{path/to/existing_file}} {{path/to/new_file}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
ln
Options
--backup=<CONTROL>
make a backup of each existing destination file
-b
like --backup but does not accept an argument
--force
,-f
ln-help-force
--interactive
,-i
ln-help-interactive
--no-dereference
,-n
ln-help-no-dereference
--logical
,-L
ln-help-logical
--physical
,-P
ln-help-physical
--symbolic
,-s
ln-help-symbolic
--suffix=<SUFFIX>
,-S <SUFFIX>
override the usual backup suffix
--target-directory=<DIRECTORY>
,-t <DIRECTORY>
ln-help-target-directory
--no-target-directory
,-T
ln-help-no-target-directory
--relative
,-r
ln-help-relative
--verbose
,-v
ln-help-verbose
Examples
Create a symbolic link to a file or directory:
ln {{[-s|--symbolic]}} {{/path/to/file_or_directory}} {{path/to/symlink}}
Overwrite an existing symbolic link to point to a different file:
ln {{[-sf|--symbolic --force]}} {{/path/to/new_file}} {{path/to/symlink}}
Create a hard link to a file:
ln {{/path/to/file}} {{path/to/hardlink}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
logname
Options
Examples
Display the currently logged in user's name:
logname
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
ls
Options
--help
ls-help-print-help
--format
ls-help-set-display-format
-C
ls-help-display-files-columns
--long
,-l
ls-help-display-detailed-info
-x
ls-help-list-entries-rows
--tabsize=<COLS>
,-T <COLS>
ls-help-assume-tab-stops
-m
ls-help-list-entries-commas
--zero
ls-help-list-entries-nul
--dired
,-D
ls-help-generate-dired-output
--hyperlink=<WHEN>
ls-help-hyperlink-filenames
-1
ls-help-list-one-file-per-line
-o
ls-help-long-format-no-group
-g
ls-help-long-no-owner
--numeric-uid-gid
,-n
ls-help-long-numeric-uid-gid
--quoting-style
ls-help-set-quoting-style
--literal
,-N
ls-help-literal-quoting-style
--escape
,-b
ls-help-escape-quoting-style
--quote-name
,-Q
ls-help-c-quoting-style
--hide-control-chars
,-q
ls-help-replace-control-chars
--show-control-chars
ls-help-show-control-chars
--time=<field>
ls-help-show-time-field
-c
ls-help-time-change
-u
ls-help-time-access
--hide=<PATTERN>
ls-help-hide-pattern
--ignore=<PATTERN>
,-I <PATTERN>
ls-help-ignore-pattern
--ignore-backups
,-B
ls-help-ignore-backups
--sort=<field>
ls-help-sort-by-field
-S
ls-help-sort-by-size
-t
ls-help-sort-by-time
-v
ls-help-sort-by-version
-X
ls-help-sort-by-extension
-U
ls-help-sort-none
--dereference
,-L
ls-help-dereference-all
--dereference-command-line-symlink-to-dir
ls-help-dereference-dir-args
--dereference-command-line
,-H
ls-help-dereference-args
--no-group
,-G
ls-help-no-group
--author
ls-help-author
--all
,-a
ls-help-all-files
--almost-all
,-A
ls-help-almost-all
--directory
,-d
ls-help-directory
--human-readable
,-h
ls-help-human-readable
--kibibytes
,-k
ls-help-kibibytes
--si
ls-help-si
--block-size=<BLOCK_SIZE>
ls-help-block-size
--inode
,-i
ls-help-print-inode
--reverse
,-r
ls-help-reverse-sort
--recursive
,-R
ls-help-recursive
--width=<COLS>
,-w <COLS>
ls-help-terminal-width
--size
,-s
ls-help-allocation-size
--color
ls-help-color-output
--indicator-style
ls-help-indicator-style
--classify=<when>
,-F <when>
ls-help-classify
--file-type
ls-help-file-type
-p
ls-help-slash-directories
--time-style=<TIME_STYLE>
ls-help-time-style
--full-time
ls-help-full-time
--context
,-Z
ls-help-context
--group-directories-first
ls-help-group-directories-first
Examples
List files one per line:
ls -1
List all files, including hidden files:
ls {{[-a|--all]}}
List files with a trailing symbol to indicate file type (directory/, symbolic_link@, executable*, ...):
ls {{[-F|--classify]}}
List all files in [l]ong format (permissions, ownership, size, and modification date):
ls {{[-la|-l --all]}}
List files in [l]ong format with size displayed using human-readable units (KiB, MiB, GiB):
ls {{[-lh|-l --human-readable]}}
List files in [l]ong format, sorted by [S]ize (descending) recursively:
ls {{[-lSR|-lS --recursive]}}
List files in [l]ong format, sorted by [t]ime the file was modified and in reverse order (oldest first):
ls {{[-ltr|-lt --reverse]}}
Only list directories:
ls {{[-d|--directory]}} */
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
md5sum
Options
--binary
,-b
hashsum-help-binary-other
--check
,-c
hashsum-help-check
--tag
hashsum-help-tag
--text
,-t
hashsum-help-text-other
--quiet
,-q
hashsum-help-quiet
--status
,-s
hashsum-help-status
--strict
hashsum-help-strict
--ignore-missing
hashsum-help-ignore-missing
--warn
,-w
hashsum-help-warn
--zero
,-z
hashsum-help-zero
Examples
Calculate the MD5 checksum for one or more files:
md5sum {{path/to/file1 path/to/file2 ...}}
Calculate and save the list of MD5 checksums to a file:
md5sum {{path/to/file1 path/to/file2 ...}} > {{path/to/file.md5}}
Calculate an MD5 checksum fromstdin
:
{{command}} | md5sum
Read a file of MD5 checksums and filenames and verify all files have matching checksums:
md5sum {{[-c|--check]}} {{path/to/file.md5}}
Only show a message for missing files or when verification fails:
md5sum {{[-c|--check]}} --quiet {{path/to/file.md5}}
Only show a message when verification fails, ignoring missing files:
md5sum --ignore-missing {{[-c|--check]}} --quiet {{path/to/file.md5}}
Check a known MD5 checksum of a file:
echo {{known_md5_checksum_of_the_file}} {{path/to/file}} | md5sum {{[-c|--check]}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
mkdir
Options
--mode
,-m
mkdir-help-mode
--parents
,-p
mkdir-help-parents
--verbose
,-v
mkdir-help-verbose
-Z
mkdir-help-selinux
--context=<CTX>
mkdir-help-context
Examples
Create specific directories:
mkdir {{path/to/directory1 path/to/directory2 ...}}
Create specific directories and their parents if needed:
mkdir {{[-p|--parents]}} {{path/to/directory1 path/to/directory2 ...}}
Create directories with specific permissions:
mkdir {{[-m|--mode]}} {{rwxrw-r--}} {{path/to/directory1 path/to/directory2 ...}}
Create multiple nested directories recursively:
mkdir {{[-p|--parents]}} {{path/to/{a,b}/{x,y,z}/{h,i,j}}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
mkfifo
Options
--mode=<MODE>
,-m <MODE>
mkfifo-help-mode
-Z
mkfifo-help-selinux
--context=<CTX>
mkfifo-help-context
Examples
Create a named pipe at a given path:
mkfifo {{path/to/pipe}}
Send data through a named pipe and send the command to the background:
echo "{{Hello World}}" > {{path/to/pipe}} &
Receive data through a named pipe:
cat {{path/to/pipe}}
Share your terminal session in real-time:
mkfifo {{path/to/pipe}}; script {{[-f|--flush]}} {{path/to/pipe}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
mknod
Options
--mode=<MODE>
,-m <MODE>
mknod-help-mode
mknod-help-name
mknod-help-type
mknod-help-major
mknod-help-minor
-Z
mknod-help-selinux
--context=<CTX>
mknod-help-context
Examples
Create a block device:
sudo mknod {{path/to/device_file}} b {{major_device_number}} {{minor_device_number}}
Create a character device:
sudo mknod {{path/to/device_file}} c {{major_device_number}} {{minor_device_number}}
Create a FIFO (queue) device:
sudo mknod {{path/to/device_file}} p
Create a device file with default SELinux security context:
sudo mknod {{[-Z |--context=]}}{{path/to/device_file}} {{type}} {{major_device_number}} {{minor_device_number}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
mktemp
Options
--directory
,-d
mktemp-help-directory
--dry-run
,-u
mktemp-help-dry-run
--quiet
,-q
mktemp-help-quiet
--suffix=<SUFFIX>
mktemp-help-suffix
-p <DIR>
mktemp-help-p
--tmpdir=<DIR>
mktemp-help-tmpdir
-t
mktemp-help-t
Examples
Create an empty temporary file and print its absolute path:
mktemp
Use a custom directory if$TMPDIR
is not set (the default is platform-dependent, but usually/tmp
):
mktemp -p {{/path/to/tempdir}}
Use a custom path template (X
s are replaced with random alphanumeric characters):
mktemp {{/tmp/example.XXXXXXXX}}
Use a custom file name template:
mktemp -t {{example.XXXXXXXX}}
Create an empty temporary directory and print its absolute path:
mktemp -d
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
more
Options
--silent
,-d
more-help-silent
--logical
,-l
more-help-logical
--exit-on-eof
,-e
more-help-exit-on-eof
--no-pause
,-f
more-help-no-pause
--print-over
,-p
more-help-print-over
--clean-print
,-c
more-help-clean-print
--squeeze
,-s
more-help-squeeze
--plain
,-u
more-help-plain
--lines=<number>
,-n <number>
more-help-lines
--number
more-help-number
--from-line=<number>
,-F <number>
more-help-from-line
--pattern=<pattern>
,-P <pattern>
more-help-pattern
more-help-files
Examples
Open a file:
more {{path/to/file}}
Display a specific line:
more +{{line_number}} {{path/to/file}}
Go to the next page:
<Space>
Search for a string (press<n>
to go to the next match):
</>{{something}}<Enter>
Exit:
<q>
Display help about interactive commands:
<h>
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
mv
Options
--force
,-f
mv-help-force
--interactive
,-i
mv-help-interactive
--no-clobber
,-n
mv-help-no-clobber
--strip-trailing-slashes
mv-help-strip-trailing-slashes
--backup=<CONTROL>
make a backup of each existing destination file
-b
like --backup but does not accept an argument
--suffix=<SUFFIX>
,-S <SUFFIX>
override the usual backup suffix
--update
move only when the SOURCE file is newer than the destination file or when the destination file is missing
-u
like --update but does not accept an argument
--target-directory=<DIRECTORY>
,-t <DIRECTORY>
mv-help-target-directory
--no-target-directory
,-T
mv-help-no-target-directory
--verbose
,-v
mv-help-verbose
--progress
,-g
mv-help-progress
--debug
mv-help-debug
Examples
Rename a file or directory when the target is not an existing directory:
mv {{path/to/source}} {{path/to/target}}
Move a file or directory into an existing directory:
mv {{path/to/source}} {{path/to/existing_directory}}
Move multiple files into an existing directory, keeping the filenames unchanged:
mv {{path/to/source1 path/to/source2 ...}} {{path/to/existing_directory}}
Do not prompt for confirmation before overwriting existing files:
mv {{[-f|--force]}} {{path/to/source}} {{path/to/target}}
Prompt for confirmation interactively before overwriting existing files, regardless of file permissions:
mv {{[-i|--interactive]}} {{path/to/source}} {{path/to/target}}
Do not overwrite existing files at the target:
mv {{[-n|--no-clobber]}} {{path/to/source}} {{path/to/target}}
Move files in verbose mode, showing files after they are moved:
mv {{[-v|--verbose]}} {{path/to/source}} {{path/to/target}}
Specify target directory so that you can use external tools to gather movable files:
{{find /var/log -type f -name '*.log' -print0}} | {{xargs -0}} mv {{[-t|--target-directory]}} {{path/to/target_directory}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
nice
Options
--adjustment
,-n
nice-help-adjustment
Examples
Launch a program with altered priority:
nice -{{niceness_value}} {{command}}
Define the priority with an explicit option:
nice {{[-n|--adjustment]}} {{niceness_value}} {{command}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
nl
Options
--help
nl-help-help
--body-numbering=<STYLE>
,-b <STYLE>
nl-help-body-numbering
--section-delimiter=<CC>
,-d <CC>
nl-help-section-delimiter
--footer-numbering=<STYLE>
,-f <STYLE>
nl-help-footer-numbering
--header-numbering=<STYLE>
,-h <STYLE>
nl-help-header-numbering
--line-increment=<NUMBER>
,-i <NUMBER>
nl-help-line-increment
--join-blank-lines=<NUMBER>
,-l <NUMBER>
nl-help-join-blank-lines
--number-format=<FORMAT>
,-n <FORMAT>
nl-help-number-format
--no-renumber
,-p
nl-help-no-renumber
--number-separator=<STRING>
,-s <STRING>
nl-help-number-separator
--starting-line-number=<NUMBER>
,-v <NUMBER>
nl-help-starting-line-number
--number-width=<NUMBER>
,-w <NUMBER>
nl-help-number-width
Examples
Number non-blank lines in a file:
nl {{path/to/file}}
Read fromstdin
:
{{command}} | nl -
Number [a]ll [b]ody lines including blank lines or do [n]ot number [b]ody lines:
nl -b {{a|n}} {{path/to/file}}
Number only the [b]ody lines that match a basic regular expression (BRE) [p]attern:
nl -b p'FooBar[0-9]' {{path/to/file}}
Use a specific [i]ncrement for line numbering:
nl -i {{increment}} {{path/to/file}}
Specify the line numbering format to [r]ight or [l]eft justified, keeping leading [z]eros or [n]ot:
nl -n {{rz|ln|rn}}
Specify the line numbering's [w]idth (6 by default):
nl -w {{col_width}} {{path/to/file}}
Use a specific string to [s]eparate the line numbers from the lines (TAB by default):
nl -s {{separator}} {{path/to/file}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
nohup
Options
Examples
Run a process that can live beyond the terminal:
nohup {{command}} {{argument1 argument2 ...}}
Launchnohup
in background mode:
nohup {{command}} {{argument1 argument2 ...}} &
Run a shell script that can live beyond the terminal:
nohup {{path/to/script.sh}} &
Run a process and write the output to a specific file:
nohup {{command}} {{argument1 argument2 ...}} > {{path/to/output_file}} &
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
nproc
Options
--all
nproc-help-all
--ignore=<N>
nproc-help-ignore
Examples
Display the number of available processing units:
nproc
Display the number of installed processing units, including any inactive ones:
nproc --all
If possible, subtract a given number of units from the returned value:
nproc --ignore {{count}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
numfmt
Options
--delimiter=<X>
,-d <X>
numfmt-help-delimiter
--field=<FIELDS>
numfmt-help-field
--format=<FORMAT>
numfmt-help-format
--from=<UNIT>
numfmt-help-from
--from-unit=<N>
numfmt-help-from-unit
--to=<UNIT>
numfmt-help-to
--to-unit=<N>
numfmt-help-to-unit
--padding=<N>
numfmt-help-padding
--header=<N>
numfmt-help-header
--round=<METHOD>
numfmt-help-round
--suffix=<SUFFIX>
numfmt-help-suffix
--invalid=<INVALID>
numfmt-help-invalid
--zero-terminated
,-z
numfmt-help-zero-terminated
Examples
Convert 1.5K (SI Units) to 1500:
numfmt --from si 1.5K
Convert 5th field (1-indexed) to IEC Units without converting header:
ls -l | numfmt --header=1 --field 5 --to iec
Convert to IEC units, pad with 5 characters, left aligned:
du {{[-s|--summarize]}} * | numfmt --to iec --format "%-5f"
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
od
Options
--help
od-help-help
--address-radix=<RADIX>
,-A <RADIX>
od-help-address-radix
--skip-bytes=<BYTES>
,-j <BYTES>
od-help-skip-bytes
--read-bytes=<BYTES>
,-N <BYTES>
od-help-read-bytes
--endian=<big|little>
od-help-endian
--strings=<BYTES>
,-S <BYTES>
NotImplemented: output strings of at least BYTES graphic chars. 3 is assumed when BYTES is not specified.
-a
od-help-a
-b
od-help-b
-c
od-help-c
-d
od-help-d
-D
od-help-d4
-o
octal 2-byte units
-I
decimal 8-byte units
-L
decimal 8-byte units
-i
decimal 4-byte units
-l
decimal 8-byte units
-x
hexadecimal 2-byte units
-h
hexadecimal 2-byte units
-O
octal 4-byte units
-s
decimal 2-byte units
-X
hexadecimal 4-byte units
-H
hexadecimal 4-byte units
-e
floating point double precision (64-bit) units
-f
floating point double precision (32-bit) units
-F
floating point double precision (64-bit) units
--format=<TYPE>
,-t <TYPE>
od-help-format
--output-duplicates
,-v
od-help-output-duplicates
--width=<BYTES>
,-w <BYTES>
od-help-width
--traditional
od-help-traditional
Examples
Display file using default settings: octal format, 8 bytes per line, byte offsets in octal, and duplicate lines replaced with*
:
od {{path/to/file}}
Display file in verbose mode, i.e. without replacing duplicate lines with*
:
od {{[-v|--output-duplicates]}} {{path/to/file}}
Display file in hexadecimal format (2-byte units), with byte offsets in decimal format:
od {{[-t|--format]}} {{x}} {{[-A|--address-radix]}} {{d}} {{[-v|--output-duplicates]}} {{path/to/file}}
Display file in hexadecimal format (1-byte units), and 4 bytes per line:
od {{[-t|--format]}} {{x1}} {{[-w|--width=]}}4 {{[-v|--output-duplicates]}} {{path/to/file}}
Display file in hexadecimal format along with its character representation, and do not print byte offsets:
od {{[-t|--format]}} {{xz}} {{[-A|--address-radix]}} {{n}} {{[-v|--output-duplicates]}} {{path/to/file}}
Read only 100 bytes of a file starting from the 500th byte:
od {{[-N|--read-bytes]}} 100 {{[-j|--skip-bytes]}} 500 {{[-v|--output-duplicates]}} {{path/to/file}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
paste
Options
--serial
,-s
paste-help-serial
--delimiters=<LIST>
,-d <LIST>
paste-help-delimiter
--zero-terminated
,-z
paste-help-zero-terminated
Examples
Join all the lines into a single line, using TAB as delimiter:
paste {{[-s|--serial]}} {{path/to/file}}
Join all the lines into a single line, using the specified delimiter:
paste {{[-sd|--serial --delimiters]}} {{delimiter}} {{path/to/file}}
Merge two files side by side, each in its column, using TAB as delimiter:
paste {{path/to/file1}} {{path/to/file2}}
Merge two files side by side, each in its column, using the specified delimiter:
paste {{[-d|--delimiters]}} {{delimiter}} {{path/to/file1}} {{path/to/file2}}
Merge two files, with lines added alternatively:
paste {{[-d|--delimiters]}} '\n' {{path/to/file1}} {{path/to/file2}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
pathchk
Options
-p
pathchk-help-posix
-P
pathchk-help-posix-special
--portability
pathchk-help-portability
Examples
Check pathnames for validity in the current system:
pathchk {{path1 path2 ...}}
Check pathnames for validity on a wider range of POSIX compliant systems:
pathchk -p {{path1 path2 ...}}
Check pathnames for validity on all POSIX compliant systems:
pathchk {{[-p -P|--portability]}} {{path1 path2 ...}}
Only check for empty pathnames or leading dashes (-):
pathchk -P {{path1 path2 ...}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
pinky
Options
-l
pinky-help-long-format
-b
pinky-help-omit-home-dir
-h
pinky-help-omit-project-file
-p
pinky-help-omit-plan-file
-s
pinky-help-short-format
-f
pinky-help-omit-headings
-w
pinky-help-omit-name
-i
pinky-help-omit-name-host
-q
pinky-help-omit-name-host-time
--help
pinky-help-help
Examples
Display details about the current user:
pinky
Display details for a specific user:
pinky {{user}}
Display details in the long format:
pinky {{user}} -l
Omit the user's home directory and shell in long format:
pinky {{user}} -lb
Omit the user's project file in long format:
pinky {{user}} -lh
Omit the column headings in short format:
pinky {{user}} -f
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
pr
Options
--pages=<FIRST_PAGE[:LAST_PAGE]>
pr-help-pages
--header=<STRING>
,-h <STRING>
pr-help-header
--double-space
,-d
pr-help-double-space
--number-lines=<[char][width]>
,-n <[char][width]>
pr-help-number-lines
--first-line-number=<NUMBER>
,-N <NUMBER>
pr-help-first-line-number
--omit-header
,-t
pr-help-omit-header
--length=<PAGE_LENGTH>
,-l <PAGE_LENGTH>
pr-help-page-length
--no-file-warnings
,-r
pr-help-no-file-warnings
--form-feed
,-F
pr-help-form-feed
--width=<width>
,-w <width>
pr-help-column-width
--page-width=<width>
,-W <width>
pr-help-page-width
--across
,-a
pr-help-across
--column=<column>
pr-help-column
--separator=<char>
,-s <char>
pr-help-column-char-separator
--sep-string=<string>
,-S <string>
pr-help-column-string-separator
--merge
,-m
pr-help-merge
--indent=<margin>
,-o <margin>
pr-help-indent
-J
pr-help-join-lines
--help
pr-help-help
Examples
Print multiple files with a default header and footer:
pr {{path/to/file1 path/to/file2 ...}}
Print with a custom centered header:
pr {{[-h|--header]}} "{{header}}" {{path/to/file1 path/to/file2 ...}}
Print with numbered lines and a custom date format:
pr {{[-n|--number-lines]}} {{[-D|--date-format]}} "{{format}}" {{path/to/file1 path/to/file2 ...}}
Print all files together, one in each column, without a header or footer:
pr {{[-m|--merge]}} {{[-T|--omit-pagination]}} {{path/to/file1 path/to/file2 ...}}
Print, beginning at page 2 up to page 5, with a given page length (including header and footer):
pr +2:5 {{[-l|--length]}} {{page_length}} {{path/to/file1 path/to/file2 ...}}
Print with an offset for each line and a truncating custom page width:
pr {{[-o|--indent]}} {{offset}} {{[-W|--page_width]}} {{width}} {{path/to/file1 path/to/file2 ...}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
printenv
Options
--null
,-0
printenv-help-null
Examples
Display key-value pairs of all environment variables:
printenv
Display the value of a specific variable:
printenv {{HOME}}
Display the value of a variable and end with NUL instead of newline:
printenv {{[-0|--null]}} {{HOME}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
printf
Options
--help
printf-help-help
--version
printf-help-version
Examples
Print a text message:
printf "{{%s\n}}" "{{Hello world}}"
Print an integer in bold blue:
printf "{{\e[1;34m%.3d\e[0m\n}}" {{42}}
Print a float number with the Unicode Euro sign:
printf "{{\u20AC %.2f\n}}" {{123.4}}
Print a text message composed with environment variables:
printf "{{var1: %s\tvar2: %s\n}}" "{{$VAR1}}" "{{$VAR2}}"
Store a formatted message in a variable (does not work on Zsh):
printf -v {{myvar}} {{"This is %s = %d\n" "a year" 2016}}
Print a hexadecimal, octal and scientific number:
printf "{{hex=%x octal=%o scientific=%e}}" 0x{{FF}} 0{{377}} {{100000}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
ptx
Options
--auto-reference
,-A
ptx-help-auto-reference
--traditional
,-G
ptx-help-traditional
--flag-truncation=<STRING>
,-F <STRING>
ptx-help-flag-truncation
--macro-name=<STRING>
,-M <STRING>
ptx-help-macro-name
--format
-O
ptx-help-roff
-T
ptx-help-tex
--right-side-refs
,-R
ptx-help-right-side-refs
--sentence-regexp=<REGEXP>
,-S <REGEXP>
ptx-help-sentence-regexp
--word-regexp=<REGEXP>
,-W <REGEXP>
ptx-help-word-regexp
--break-file=<FILE>
,-b <FILE>
ptx-help-break-file
--ignore-case
,-f
ptx-help-ignore-case
--gap-size=<NUMBER>
,-g <NUMBER>
ptx-help-gap-size
--ignore-file=<FILE>
,-i <FILE>
ptx-help-ignore-file
--only-file=<FILE>
,-o <FILE>
ptx-help-only-file
--references=<FILE>
,-r <FILE>
ptx-help-references
--width=<NUMBER>
,-w <NUMBER>
ptx-help-width
Examples
Generate a permuted index where the first field of each line is an index reference:
ptx {{[-r|--references]}} {{path/to/file}}
Generate a permuted index with automatically generated index references:
ptx {{[-A|--auto-reference]}} {{path/to/file}}
Generate a permuted index with a fixed width:
ptx {{[-w|--width]}} {{width_in_columns}} {{path/to/file}}
Generate a permuted index with a list of filtered words:
ptx {{[-o|--only-file]}} {{path/to/filter}} {{path/to/file}}
Generate a permuted index with SYSV-style behaviors:
ptx {{[-G|--traditional]}} {{path/to/file}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
pwd
Options
--logical
,-L
pwd-help-logical
--physical
,-P
pwd-help-physical
Examples
Print the current directory:
pwd
Print the current directory, and resolve all symlinks (i.e. show the "physical" path):
pwd {{[-P|--physical]}}
Display help:
pwd --help
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
readlink
Options
--canonicalize
,-f
readlink-help-canonicalize
--canonicalize-existing
,-e
readlink-help-canonicalize-existing
--canonicalize-missing
,-m
readlink-help-canonicalize-missing
--no-newline
,-n
readlink-help-no-newline
--quiet
,-q
readlink-help-quiet
--silent
,-s
readlink-help-silent
--verbose
,-v
readlink-help-verbose
--zero
,-z
readlink-help-zero
Examples
Get the actual file to which the symlink points:
readlink {{path/to/file}}
Get the absolute path to a file:
readlink {{[-f|--canonicalize]}} {{path/to/file}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
realpath
Options
--quiet
,-q
realpath-help-quiet
--strip
,--no-symlinks
,-s
realpath-help-strip
--zero
,-z
realpath-help-zero
--logical
,-L
realpath-help-logical
--physical
,-P
realpath-help-physical
--canonicalize-existing
,-e
realpath-help-canonicalize-existing
--canonicalize-missing
,-m
realpath-help-canonicalize-missing
--relative-to=<DIR>
realpath-help-relative-to
--relative-base=<DIR>
realpath-help-relative-base
Examples
Display the absolute path for a file or directory:
realpath {{path/to/file_or_directory}}
Require all path components to exist:
realpath {{[-e|--canonicalize-existing]}} {{path/to/file_or_directory}}
Resolve ".." components before symlinks:
realpath {{[-L|--logical]}} {{path/to/file_or_directory}}
Disable symlink expansion:
realpath {{[-s|--no-symlinks]}} {{path/to/file_or_directory}}
Suppress error messages:
realpath {{[-q|--quiet]}} {{path/to/file_or_directory}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
rm
Options
--force
,-f
rm-help-force
-i
rm-help-prompt-always
-I
rm-help-prompt-once
--interactive=<WHEN>
rm-help-interactive
--one-file-system
rm-help-one-file-system
--no-preserve-root
rm-help-no-preserve-root
--preserve-root
rm-help-preserve-root
--recursive
,-r
,-R
rm-help-recursive
--dir
,-d
rm-help-dir
--verbose
,-v
rm-help-verbose
--presume-input-tty
Examples
Remove specific files:
rm {{path/to/file1 path/to/file2 ...}}
Remove specific files ignoring nonexistent ones:
rm {{[-f|--force]}} {{path/to/file1 path/to/file2 ...}}
Remove specific files interactively prompting before each removal:
rm {{[-i|--interactive]}} {{path/to/file1 path/to/file2 ...}}
Remove specific files printing info about each removal:
rm {{[-v|--verbose]}} {{path/to/file1 path/to/file2 ...}}
Remove specific files and directories recursively:
rm {{[-r|--recursive]}} {{path/to/file_or_directory1 path/to/file_or_directory2 ...}}
Remove empty directories (this is considered the safe method):
rm {{[-d|--dir]}} {{path/to/directory}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
rmdir
Options
--ignore-fail-on-non-empty
rmdir-help-ignore-fail-non-empty
--parents
,-p
rmdir-help-parents
--verbose
,-v
rmdir-help-verbose
Examples
Remove specific directories:
rmdir {{path/to/directory1 path/to/directory2 ...}}
Remove specific nested directories recursively:
rmdir {{[-p|--parents]}} {{path/to/directory1 path/to/directory2 ...}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
runcon
Options
--compute
,-c
runcon-help-compute
--user=<USER>
,-u <USER>
runcon-help-user
--role=<ROLE>
,-r <ROLE>
runcon-help-role
--type=<TYPE>
,-t <TYPE>
runcon-help-type
--range=<RANGE>
,-l <RANGE>
runcon-help-range
Examples
Print the security context of the current execution context:
runcon
Specify the domain to run a command in:
runcon {{[-t|--type]}} {{domain}}_t {{command}}
Specify the context role to run a command with:
runcon {{[-r|--role]}} {{role}}_r {{command}}
Specify the full context to run a command with:
runcon {{user}}_u:{{role}}_r:{{domain}}_t {{command}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
seq
Options
--separator
,-s
seq-help-separator
--terminator
,-t
seq-help-terminator
--equal-width
,-w
seq-help-equal-width
--format
,-f
seq-help-format
Examples
Sequence from 1 to 10:
seq 10
Every 3rd number from 5 to 20:
seq 5 3 20
Separate the output with a space instead of a newline:
seq {{[-s|--separator]}} " " 5 3 20
Format output width to a minimum of 4 digits padding with zeros as necessary:
seq {{[-f|--format]}} "%04g" 5 3 20
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
sha1sum
Options
--binary
,-b
hashsum-help-binary-other
--check
,-c
hashsum-help-check
--tag
hashsum-help-tag
--text
,-t
hashsum-help-text-other
--quiet
,-q
hashsum-help-quiet
--status
,-s
hashsum-help-status
--strict
hashsum-help-strict
--ignore-missing
hashsum-help-ignore-missing
--warn
,-w
hashsum-help-warn
--zero
,-z
hashsum-help-zero
Examples
Calculate the SHA1 checksum for one or more files:
sha1sum {{path/to/file1 path/to/file2 ...}}
Calculate and save the list of SHA1 checksums to a file:
sha1sum {{path/to/file1 path/to/file2 ...}} > {{path/to/file.sha1}}
Calculate a SHA1 checksum fromstdin
:
{{command}} | sha1sum
Read a file of SHA1 checksums and filenames and verify all files have matching checksums:
sha1sum {{[-c|--check]}} {{path/to/file.sha1}}
Only show a message for missing files or when verification fails:
sha1sum {{[-c|--check]}} --quiet {{path/to/file.sha1}}
Only show a message when verification fails, ignoring missing files:
sha1sum --ignore-missing {{[-c|--check]}} --quiet {{path/to/file.sha1}}
Check a known SHA1 checksum of a file:
echo {{known_sha1_checksum_of_the_file}} {{path/to/file}} | sha1sum {{[-c|--check]}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
sha224sum
Options
--binary
,-b
hashsum-help-binary-other
--check
,-c
hashsum-help-check
--tag
hashsum-help-tag
--text
,-t
hashsum-help-text-other
--quiet
,-q
hashsum-help-quiet
--status
,-s
hashsum-help-status
--strict
hashsum-help-strict
--ignore-missing
hashsum-help-ignore-missing
--warn
,-w
hashsum-help-warn
--zero
,-z
hashsum-help-zero
Examples
Calculate the SHA224 checksum for one or more files:
sha224sum {{path/to/file1 path/to/file2 ...}}
Calculate and save the list of SHA224 checksums to a file:
sha224sum {{path/to/file1 path/to/file2 ...}} > {{path/to/file.sha224}}
Calculate a SHA224 checksum fromstdin
:
{{command}} | sha224sum
Read a file of SHA224 checksums and filenames and verify all files have matching checksums:
sha224sum {{[-c|--check]}} {{path/to/file.sha224}}
Only show a message for missing files or when verification fails:
sha224sum {{[-c|--check]}} --quiet {{path/to/file.sha224}}
Only show a message when verification fails, ignoring missing files:
sha224sum --ignore-missing {{[-c|--check]}} --quiet {{path/to/file.sha224}}
Check a known SHA224 checksum of a file:
echo {{known_sha224_checksum_of_the_file}} {{path/to/file}} | sha224sum {{[-c|--check]}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
sha256sum
Options
--binary
,-b
hashsum-help-binary-other
--check
,-c
hashsum-help-check
--tag
hashsum-help-tag
--text
,-t
hashsum-help-text-other
--quiet
,-q
hashsum-help-quiet
--status
,-s
hashsum-help-status
--strict
hashsum-help-strict
--ignore-missing
hashsum-help-ignore-missing
--warn
,-w
hashsum-help-warn
--zero
,-z
hashsum-help-zero
Examples
Calculate the SHA256 checksum for one or more files:
sha256sum {{path/to/file1 path/to/file2 ...}}
Calculate and save the list of SHA256 checksums to a file:
sha256sum {{path/to/file1 path/to/file2 ...}} > {{path/to/file.sha256}}
Calculate a SHA256 checksum fromstdin
:
{{command}} | sha256sum
Read a file of SHA256 checksums and filenames and verify all files have matching checksums:
sha256sum {{[-c|--check]}} {{path/to/file.sha256}}
Only show a message for missing files or when verification fails:
sha256sum {{[-c|--check]}} --quiet {{path/to/file.sha256}}
Only show a message when verification fails, ignoring missing files:
sha256sum --ignore-missing {{[-c|--check]}} --quiet {{path/to/file.sha256}}
Check a known SHA256 checksum of a file:
echo {{known_sha256_checksum_of_the_file}} {{path/to/file}} | sha256sum {{[-c|--check]}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
sha3-224sum
Options
--binary
,-b
hashsum-help-binary-other
--check
,-c
hashsum-help-check
--tag
hashsum-help-tag
--text
,-t
hashsum-help-text-other
--quiet
,-q
hashsum-help-quiet
--status
,-s
hashsum-help-status
--strict
hashsum-help-strict
--ignore-missing
hashsum-help-ignore-missing
--warn
,-w
hashsum-help-warn
--zero
,-z
hashsum-help-zero
sha3-256sum
Options
--binary
,-b
hashsum-help-binary-other
--check
,-c
hashsum-help-check
--tag
hashsum-help-tag
--text
,-t
hashsum-help-text-other
--quiet
,-q
hashsum-help-quiet
--status
,-s
hashsum-help-status
--strict
hashsum-help-strict
--ignore-missing
hashsum-help-ignore-missing
--warn
,-w
hashsum-help-warn
--zero
,-z
hashsum-help-zero
sha3-384sum
Options
--binary
,-b
hashsum-help-binary-other
--check
,-c
hashsum-help-check
--tag
hashsum-help-tag
--text
,-t
hashsum-help-text-other
--quiet
,-q
hashsum-help-quiet
--status
,-s
hashsum-help-status
--strict
hashsum-help-strict
--ignore-missing
hashsum-help-ignore-missing
--warn
,-w
hashsum-help-warn
--zero
,-z
hashsum-help-zero
sha3-512sum
Options
--binary
,-b
hashsum-help-binary-other
--check
,-c
hashsum-help-check
--tag
hashsum-help-tag
--text
,-t
hashsum-help-text-other
--quiet
,-q
hashsum-help-quiet
--status
,-s
hashsum-help-status
--strict
hashsum-help-strict
--ignore-missing
hashsum-help-ignore-missing
--warn
,-w
hashsum-help-warn
--zero
,-z
hashsum-help-zero
sha384sum
Options
--binary
,-b
hashsum-help-binary-other
--check
,-c
hashsum-help-check
--tag
hashsum-help-tag
--text
,-t
hashsum-help-text-other
--quiet
,-q
hashsum-help-quiet
--status
,-s
hashsum-help-status
--strict
hashsum-help-strict
--ignore-missing
hashsum-help-ignore-missing
--warn
,-w
hashsum-help-warn
--zero
,-z
hashsum-help-zero
Examples
Calculate the SHA384 checksum for one or more files:
sha384sum {{path/to/file1 path/to/file2 ...}}
Calculate and save the list of SHA384 checksums to a file:
sha384sum {{path/to/file1 path/to/file2 ...}} > {{path/to/file.sha384}}
Calculate a SHA384 checksum fromstdin
:
{{command}} | sha384sum
Read a file of SHA384 checksums and filenames and verify all files have matching checksums:
sha384sum {{[-c|--check]}} {{path/to/file.sha384}}
Only show a message for missing files or when verification fails:
sha384sum {{[-c|--check]}} --quiet {{path/to/file.sha384}}
Only show a message when verification fails, ignoring missing files:
sha384sum --ignore-missing {{[-c|--check]}} --quiet {{path/to/file.sha384}}
Check a known SHA384 checksum of a file:
echo {{known_sha384_checksum_of_the_file}} {{path/to/file}} | sha384sum {{[-c|--check]}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
sha3sum
Options
--binary
,-b
hashsum-help-binary-other
--check
,-c
hashsum-help-check
--tag
hashsum-help-tag
--text
,-t
hashsum-help-text-other
--quiet
,-q
hashsum-help-quiet
--status
,-s
hashsum-help-status
--strict
hashsum-help-strict
--ignore-missing
hashsum-help-ignore-missing
--warn
,-w
hashsum-help-warn
--zero
,-z
hashsum-help-zero
--bits=<BITS>
hashsum-help-bits
sha512sum
Options
--binary
,-b
hashsum-help-binary-other
--check
,-c
hashsum-help-check
--tag
hashsum-help-tag
--text
,-t
hashsum-help-text-other
--quiet
,-q
hashsum-help-quiet
--status
,-s
hashsum-help-status
--strict
hashsum-help-strict
--ignore-missing
hashsum-help-ignore-missing
--warn
,-w
hashsum-help-warn
--zero
,-z
hashsum-help-zero
Examples
Calculate the SHA512 checksum for one or more files:
sha512sum {{path/to/file1 path/to/file2 ...}}
Calculate and save the list of SHA512 checksums to a file:
sha512sum {{path/to/file1 path/to/file2 ...}} > {{path/to/file.sha512}}
Calculate a SHA512 checksum fromstdin
:
{{command}} | sha512sum
Read a file of SHA512 checksums and filenames and verify all files have matching checksums:
sha512sum {{[-c|--check]}} {{path/to/file.sha512}}
Only show a message for missing files or when verification fails:
sha512sum {{[-c|--check]}} --quiet {{path/to/file.sha512}}
Only show a message when verification fails, ignoring missing files:
sha512sum --ignore-missing {{[-c|--check]}} --quiet {{path/to/file.sha512}}
Check a known SHA512 checksum of a file:
echo {{known_sha512_checksum_of_the_file}} {{path/to/file}} | sha512sum {{[-c|--check]}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
shake128sum
Options
--binary
,-b
hashsum-help-binary-other
--check
,-c
hashsum-help-check
--tag
hashsum-help-tag
--text
,-t
hashsum-help-text-other
--quiet
,-q
hashsum-help-quiet
--status
,-s
hashsum-help-status
--strict
hashsum-help-strict
--ignore-missing
hashsum-help-ignore-missing
--warn
,-w
hashsum-help-warn
--zero
,-z
hashsum-help-zero
--bits=<BITS>
hashsum-help-bits
shake256sum
Options
--binary
,-b
hashsum-help-binary-other
--check
,-c
hashsum-help-check
--tag
hashsum-help-tag
--text
,-t
hashsum-help-text-other
--quiet
,-q
hashsum-help-quiet
--status
,-s
hashsum-help-status
--strict
hashsum-help-strict
--ignore-missing
hashsum-help-ignore-missing
--warn
,-w
hashsum-help-warn
--zero
,-z
hashsum-help-zero
--bits=<BITS>
hashsum-help-bits
shred
Options
--force
,-f
shred-force-help
--iterations=<NUMBER>
,-n <NUMBER>
shred-iterations-help
--size=<N>
,-s <N>
shred-size-help
-u
shred-deallocate-help
--remove=<HOW>
shred-remove-help
--verbose
,-v
shred-verbose-help
--exact
,-x
shred-exact-help
--zero
,-z
shred-zero-help
--random-source
shred-random-source-help
Examples
Overwrite a file:
shred {{path/to/file}}
Overwrite a file and show progress on the screen:
shred {{[-v|--verbose]}} {{path/to/file}}
Overwrite a file, leaving zeros instead of random data:
shred {{[-z|--zero]}} {{path/to/file}}
Overwrite a file a specific number of times:
shred {{[-n|--iterations]}} {{25}} {{path/to/file}}
Overwrite a file and remove it:
shred {{[-u|--remove]}} {{path/to/file}}
Overwrite a file 100 times, add a final overwrite with zeros, remove the file after overwriting it and show verbose progress on the screen:
shred {{[-vzun|--verbose --zero --remove --iterations]}} 100 {{path/to/file}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
shuf
Options
--echo
,-e
shuf-help-echo
--input-range=<LO-HI>
,-i <LO-HI>
shuf-help-input-range
--head-count=<COUNT>
,-n <COUNT>
shuf-help-head-count
--output=<FILE>
,-o <FILE>
shuf-help-output
--random-source=<FILE>
shuf-help-random-source
--repeat
,-r
shuf-help-repeat
--zero-terminated
,-z
shuf-help-zero-terminated
Examples
Randomize the order of lines in a file and output the result:
shuf {{path/to/file}}
Only output the first 5 entries of the result:
shuf {{[-n|--head-count]}} 5 {{path/to/file}}
Write the output to another file:
shuf {{path/to/input_file}} {{[-o|--output]}} {{path/to/output_file}}
Generate 3 random numbers in the range 1-10 (inclusive):
shuf {{[-n|--head-count]}} 3 {{[-i|--input-range]}} 1-10 {{[-r|--repeat]}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
sleep
Options
sleep-help-number
Examples
Delay in seconds:
sleep {{seconds}}
Execute a specific command after 20 seconds delay:
sleep 20 && {{command}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
sort
Options
--help
sort-help-help
--version
sort-help-version
--sort
--human-numeric-sort
,-h
sort-help-human-numeric
--month-sort
,-M
sort-help-month
--numeric-sort
,-n
sort-help-numeric
--general-numeric-sort
,-g
sort-help-general-numeric
--version-sort
,-V
sort-help-version-sort
--random-sort
,-R
sort-help-random
--dictionary-order
,-d
sort-help-dictionary-order
--merge
,-m
sort-help-merge
--check
,-c
sort-help-check
--check-silent
,-C
sort-help-check-silent
--ignore-case
,-f
sort-help-ignore-case
--ignore-nonprinting
,-i
sort-help-ignore-nonprinting
--ignore-leading-blanks
,-b
sort-help-ignore-leading-blanks
--output=<FILENAME>
,-o <FILENAME>
sort-help-output
--reverse
,-r
sort-help-reverse
--stable
,-s
sort-help-stable
--unique
,-u
sort-help-unique
--key
,-k
sort-help-key
--field-separator
,-t
sort-help-separator
--zero-terminated
,-z
sort-help-zero-terminated
--parallel=<NUM_THREADS>
sort-help-parallel
--buffer-size=<SIZE>
,-S <SIZE>
sort-help-buf-size
--temporary-directory=<DIR>
,-T <DIR>
sort-help-tmp-dir
--compress-program=<PROG>
sort-help-compress-prog
--batch-size=<N_MERGE>
sort-help-batch-size
--files0-from=<NUL_FILE>
sort-help-files0-from
--debug
sort-help-debug
Examples
Sort a file in ascending order:
sort {{path/to/file}}
Sort a file in descending order:
sort {{[-r|--reverse]}} {{path/to/file}}
Sort a file in case-insensitive way:
sort {{[-f|--ignore-case]}} {{path/to/file}}
Sort a file using numeric rather than alphabetic order:
sort {{[-n|--numeric-sort]}} {{path/to/file}}
Sort/etc/passwd
by the 3rd field of each line numerically, using ":" as a field separator:
sort {{[-t|--field-separator]}} {{:}} {{[-k|--key]}} {{3n}} {{/etc/passwd}}
As above, but when items in the 3rd field are equal, sort by the 4th field by numbers with exponents:
sort {{[-t|--field-separator]}} {{:}} {{[-k|--key]}} {{3,3n}} {{[-k|--key]}} {{4,4g}} {{/etc/passwd}}
Sort a file preserving only unique lines:
sort {{[-u|--unique]}} {{path/to/file}}
Sort a file, printing the output to the specified output file (can be used to sort a file in-place):
sort {{[-o|--output]}} {{path/to/file}} {{path/to/file}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
split
Options
--bytes=<SIZE>
,-b <SIZE>
split-help-bytes
--line-bytes=<SIZE>
,-C <SIZE>
split-help-line-bytes
--lines=<NUMBER>
,-l <NUMBER>
split-help-lines
--number=<CHUNKS>
,-n <CHUNKS>
split-help-number
--additional-suffix=<SUFFIX>
split-help-additional-suffix
--filter=<COMMAND>
split-help-filter
--elide-empty-files
,-e
split-help-elide-empty-files
-d
split-help-numeric-suffixes-short
--numeric-suffixes=<FROM>
split-help-numeric-suffixes
-x
split-help-hex-suffixes-short
--hex-suffixes=<FROM>
split-help-hex-suffixes
--suffix-length=<N>
,-a <N>
split-help-suffix-length
--verbose
split-help-verbose
--separator=<SEP>
,-t <SEP>
split-help-separator
--io-blksize
Examples
Split a file, each split having 10 lines (except the last split):
split {{[-l|--lines]}} 10 {{path/to/file}}
Split a file into 5 files. File is split such that each split has same size (except the last split):
split {{[-n|--number]}} 5 {{path/to/file}}
Split a file with 512 bytes in each split (except the last split; use 512k for kilobytes and 512m for megabytes):
split {{[-b|--bytes]}} 512 {{path/to/file}}
Split a file with at most 512 bytes in each split without breaking lines:
split {{[-C|--line-bytes]}} 512 {{path/to/file}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
stat
Options
--dereference
,-L
stat-help-dereference
--file-system
,-f
stat-help-file-system
--terse
,-t
stat-help-terse
--format=<FORMAT>
,-c <FORMAT>
stat-help-format
--printf=<FORMAT>
stat-help-printf
Examples
Display properties about a specific file such as size, permissions, creation and access dates among others:
stat {{path/to/file}}
Display properties about a specific file such as size, permissions, creation and access dates among others without labels:
stat {{[-t|--terse]}} {{path/to/file}}
Display information about the filesystem where a specific file is located:
stat {{[-f|--file-system]}} {{path/to/file}}
Show only octal file permissions:
stat {{[-c|--format]}} "%a %n" {{path/to/file}}
Show the owner and group of a specific file:
stat {{[-c|--format]}} "%U %G" {{path/to/file}}
Show the size of a specific file in bytes:
stat {{[-c|--format]}} "%s %n" {{path/to/file}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
stdbuf
Options
--input=<MODE>
,-i <MODE>
stdbuf-help-input
--output=<MODE>
,-o <MODE>
stdbuf-help-output
--error=<MODE>
,-e <MODE>
stdbuf-help-error
Examples
Changestdin
buffer size to 512 KiB:
stdbuf {{[-i|--input]}} 512K {{command}}
Changestdout
buffer to line-buffered:
stdbuf {{[-o|--output]}} L {{command}}
Changestderr
buffer to unbuffered:
stdbuf {{[-e|--error]}} 0 {{command}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
stty
Options
--all
,-a
stty-option-all
--save
,-g
stty-option-save
--file=<DEVICE>
,-F <DEVICE>
stty-option-file
stty-option-settings
Examples
Display current terminal size:
stty size
Display all settings for the current terminal:
stty {{[-a|--all]}}
Set the number of rows or columns:
stty {{rows|cols}} {{count}}
Get the actual transfer speed of a device:
stty {{[-F|--file]}} {{path/to/device_file}} speed
Reset all modes to reasonable values for the current terminal:
stty sane
Switch between raw and normal mode:
stty {{raw|cooked}}
Turn character echoing off or on:
stty {{-echo|echo}}
Display help:
stty --help
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
sum
Options
-r
sum-help-bsd-compatible
--sysv
,-s
sum-help-sysv-compatible
Examples
Compute a checksum with BSD-compatible algorithm and 1024-byte blocks:
sum {{path/to/file}}
Compute a checksum with System V-compatible algorithm and 512-byte blocks:
sum {{[-s|--sysv]}} {{path/to/file}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
sync
Options
--file-system
,-f
sync-help-file-system
--data
,-d
sync-help-data
Examples
Flush all pending write operations on all disks:
sync
Flush all pending write operations on a single file to disk:
sync {{path/to/file}}
Flush writes and drop file system caches (Linux only):
sync; echo 3 | sudo tee /proc/sys/vm/drop_caches
Flush disk writes and attempts to clear inactive memory and filesystem caches (macOS only):
sync; sudo purge
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
tac
Options
--before
,-b
tac-help-before
--regex
,-r
tac-help-regex
--separator=<STRING>
,-s <STRING>
tac-help-separator
Examples
Concatenate specific files in reversed order:
tac {{path/to/file1 path/to/file2 ...}}
Displaystdin
in reversed order:
{{cat path/to/file}} | tac
Use a specific separator:
tac {{[-s|--separator]}} {{separator}} {{path/to/file1 path/to/file2 ...}}
Use a specific regex as a separator:
tac {{[-r|--regex]}} {{[-s|--separator]}} {{separator}} {{path/to/file1 path/to/file2 ...}}
Use a separator before each file:
tac {{[-b|--before]}} {{path/to/file1 path/to/file2 ...}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
tail
Options
--bytes
,-c
tail-help-bytes
--follow
,-f
tail-help-follow
--lines
,-n
tail-help-lines
--pid=<PID>
tail-help-pid
--quiet
,--silent
,-q
tail-help-quiet
--sleep-interval=<N>
,-s <N>
tail-help-sleep-interval
--max-unchanged-stats=<N>
tail-help-max-unchanged-stats
--verbose
,-v
tail-help-verbose
--zero-terminated
,-z
tail-help-zero-terminated
--use-polling
tail-help-polling-linux
--retry
tail-help-retry
-F
tail-help-follow-retry
--presume-input-pipe
Examples
Show last 'count' lines in file:
tail {{[-n|--lines]}} {{count}} {{path/to/file}}
Print a file from a specific line number:
tail {{[-n|--lines]}} +{{count}} {{path/to/file}}
Print a specific count of bytes from the end of a given file:
tail {{[-c|--bytes]}} {{count}} {{path/to/file}}
Print the last lines of a given file and keep reading it until<Ctrl c>
:
tail {{[-f|--follow]}} {{path/to/file}}
Keep reading file until<Ctrl c>
, even if the file is inaccessible:
tail {{[-F|--retry --follow]}} {{path/to/file}}
Show last 'num' lines in 'file' and refresh every 'n' seconds:
tail {{[-n|--lines]}} {{count}} {{[-s|--sleep-interval]}} {{seconds}} {{[-f|--follow]}} {{path/to/file}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
tee
Options
--help
,-h
tee-help-help
--append
,-a
tee-help-append
--ignore-interrupts
,-i
tee-help-ignore-interrupts
-p
tee-help-ignore-pipe-errors
--output-error
tee-help-output-error
Examples
Copystdin
to each file, and also tostdout
:
echo "example" | tee {{path/to/file}}
Append to the given files, do not overwrite:
echo "example" | tee {{[-a|--append]}} {{path/to/file}}
Printstdin
to the terminal, and also pipe it into another program for further processing:
echo "example" | tee {{/dev/tty}} | {{xargs printf "[%s]"}}
Create a directory called "example", count the number of characters in "example" and write "example" to the terminal:
echo "example" | tee >(xargs mkdir) >(wc {{[-c|--bytes]}})
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
test
Options
Examples
Test if a given variable is equal to a given string:
test "{{$MY_VAR}}" = "{{/bin/zsh}}"
Test if a given variable is empty ([z]ero length):
test -z "{{$GIT_BRANCH}}"
Test if a [f]ile exists:
test -f "{{path/to/file_or_directory}}"
Test if a [d]irectory does not exist:
test ! -d "{{path/to/directory}}"
If A is true, then do B, or C in the case of an error (notice that C may run even if A fails):
test {{condition}} && {{echo "true"}} || {{echo "false"}}
Usetest
in a conditional statement:
if test -f "{{path/to/file}}"; then echo "File exists"; else echo "File does not exist"; fi
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
timeout
Options
--foreground
,-f
timeout-help-foreground
--kill-after
,-k
timeout-help-kill-after
--preserve-status
,-p
timeout-help-preserve-status
--signal=<SIGNAL>
,-s <SIGNAL>
timeout-help-signal
--verbose
,-v
timeout-help-verbose
Examples
Runsleep 10
and terminate it after 3 seconds:
timeout 3s sleep 10
Send a signal to the command after the time limit expires (TERM
by default,kill -l
to list all signals):
timeout {{[-s|--signal]}} {{INT|HUP|KILL|...}} {{5s}} {{sleep 10}}
Send verbose output tostderr
showing signal sent upon timeout:
timeout {{[-v|--verbose]}} {{0.5s|1m|1h|1d|...}} {{command}}
Preserve the exit status of the command regardless of timing out:
timeout {{[-p|--preserve-status]}} {{1s|1m|1h|1d|...}} {{command}}
Send a forcefulKILL
signal after certain duration if the command ignores initial signal upon timeout:
timeout {{[-k|--kill-after]}} {{5m}} {{30s}} {{command}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
touch
Options
--help
touch-help-help
-a
touch-help-access
-t <STAMP>
touch-help-timestamp
--date=<STRING>
,-d <STRING>
touch-help-date
-f
(ignored)
-m
touch-help-modification
--no-create
,-c
touch-help-no-create
--no-dereference
,-h
touch-help-no-deref
--reference=<FILE>
,-r <FILE>
touch-help-reference
--time=<WORD>
touch-help-time
Examples
Create specific files:
touch {{path/to/file1 path/to/file2 ...}}
Set the file [a]ccess or [m]odification times to the current one and don't create file if it doesn't exist:
touch {{[-c|--no-create]}} -{{a|m}} {{path/to/file1 path/to/file2 ...}}
Set the file [t]ime to a specific value and don't create file if it doesn't exist:
touch {{[-c|--no-create]}} -t {{YYYYMMDDHHMM.SS}} {{path/to/file1 path/to/file2 ...}}
Set the files' timestamp to the reference file's timestamp, and do not create the file if it does not exist:
touch {{[-c|--no-create]}} {{[-r|--reference]}} {{path/to/reference_file}} {{path/to/file1 path/to/file2 ...}}
Set the timestamp by parsing a string:
touch {{[-d|--date]}} "{{last year|5 hours|next thursday|nov 14|...}}" {{path/to/file}}
Create multiple files with an increasing number:
touch {{path/to/file{1..10}}}
Create multiple files with a letter range:
touch {{path/to/file{a..z}}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
tr
Options
--complement
,-c
,-C
tr-help-complement
--delete
,-d
tr-help-delete
--squeeze-repeats
,-s
tr-help-squeeze
--truncate-set1
,-t
tr-help-truncate-set1
Examples
Replace all occurrences of a character in a file, and print the result:
tr {{find_character}} {{replace_character}} < {{path/to/file}}
Replace all occurrences of a character from another command's output:
echo {{text}} | tr {{find_character}} {{replace_character}}
Map each character of the first set to the corresponding character of the second set:
tr '{{abcd}}' '{{jkmn}}' < {{path/to/file}}
Delete all occurrences of the specified set of characters from the input:
tr {{[-d|--delete]}} '{{input_characters}}' < {{path/to/file}}
Compress a series of identical characters to a single character:
tr {{[-s|--squeeze-repeats]}} '{{input_characters}}' < {{path/to/file}}
Translate the contents of a file to upper-case:
tr "[:lower:]" "[:upper:]" < {{path/to/file}}
Strip out non-printable characters from a file:
tr {{[-cd|--complement --delete]}} "[:print:]" < {{path/to/file}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
true
Options
--help
true-help-text
--version
true-version-text
Examples
Return a successful exit code:
true
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
truncate
Options
--io-blocks
,-o
truncate-help-io-blocks
--no-create
,-c
truncate-help-no-create
--reference=<RFILE>
,-r <RFILE>
truncate-help-reference
--size=<SIZE>
,-s <SIZE>
truncate-help-size
Examples
Set a size of 10 GB to an existing file, or create a new file with the specified size:
truncate {{[-s|--size]}} 10G {{path/to/file}}
Extend the file size by 50 MiB, fill with holes (which reads as zero bytes):
truncate {{[-s|--size]}} +50M {{path/to/file}}
Shrink the file by 2 GiB, by removing data from the end of file:
truncate {{[-s|--size]}} -2G {{path/to/file}}
Empty the file's content:
truncate {{[-s|--size]}} 0 {{path/to/file}}
Empty the file's content, but do not create the file if it does not exist:
truncate {{[-cs|--no-create --size]}} 0 {{path/to/file}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
tsort
Options
Examples
Perform a topological sort consistent with a partial sort per line of input separated by blanks:
tsort {{path/to/file}}
Perform a topological sort consistent on strings:
echo -e "{{UI Backend\nBackend Database\nDocs UI}}" | tsort
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
tty
Options
--silent
,--quiet
,-s
tty-help-silent
Examples
Print the file name of this terminal:
tty
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
uname
Options
--all
,-a
uname-help-all
--kernel-name
,-s
uname-help-kernel-name
--nodename
,-n
uname-help-nodename
--kernel-release
,-r
uname-help-kernel-release
--kernel-version
,-v
uname-help-kernel-version
--machine
,-m
uname-help-machine
--operating-system
,-o
uname-help-os
--processor
,-p
uname-help-processor
--hardware-platform
,-i
uname-help-hardware-platform
Examples
Print kernel name:
uname
Print all available system information:
uname {{[-a|--all]}}
Print system architecture and processor information:
uname {{[-mp|--machine --processsor]}}
Print kernel name, kernel release and kernel version:
uname {{[-srv|--kernel-name --kernel-release --kernel-version]}}
Print system hostname:
uname {{[-n|--nodename]}}
Print the current operating system name:
uname {{[-o|--operating-system]}}
Print the current network node host name:
uname {{[-n|--nodename]}}
Display help:
uname --help
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
unexpand
Options
--all
,-a
unexpand-help-all
--first-only
,-f
unexpand-help-first-only
--tabs=<N, LIST>
,-t <N, LIST>
unexpand-help-tabs
--no-utf8
,-U
unexpand-help-no-utf8
Examples
Convert blanks in each file to tabs, writing tostdout
:
unexpand {{path/to/file}}
Convert blanks to tabs, reading fromstdout
:
unexpand
Convert all blanks, instead of just initial blanks:
unexpand {{[-a|--all]}} {{path/to/file}}
Convert only leading sequences of blanks (overrides -a):
unexpand --first-only {{path/to/file}}
Have tabs a certain number of characters apart, not 8 (enables -a):
unexpand {{[-t|--tabs]}} {{number}} {{path/to/file}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
uniq
Options
--all-repeated=<delimit-method>
,-D <delimit-method>
uniq-help-all-repeated
--group=<group-method>
uniq-help-group
--check-chars=<N>
,-w <N>
uniq-help-check-chars
--count
,-c
uniq-help-count
--ignore-case
,-i
uniq-help-ignore-case
--repeated
,-d
uniq-help-repeated
--skip-chars=<N>
,-s <N>
uniq-help-skip-chars
--skip-fields=<N>
,-f <N>
uniq-help-skip-fields
--unique
,-u
uniq-help-unique
--zero-terminated
,-z
uniq-help-zero-terminated
Examples
Display each line once:
sort {{path/to/file}} | uniq
Display only unique lines:
sort {{path/to/file}} | uniq {{[-u|--unique]}}
Display only duplicate lines:
sort {{path/to/file}} | uniq {{[-d|--repeated]}}
Display number of occurrences of each line along with that line:
sort {{path/to/file}} | uniq {{[-c|--count]}}
Display number of occurrences of each line, sorted by the most frequent:
sort {{path/to/file}} | uniq {{[-c|--count]}} | sort {{[-nr|--numeric-sort --reverse]}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
unlink
Options
Examples
Remove the specified file if it is the last link:
unlink {{path/to/file}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
uptime
Options
--since
,-s
uptime-help-since
uptime-help-path
Examples
Print current time, uptime, number of logged-in users and other information:
uptime
Show only the amount of time the system has been booted for:
uptime {{[-p|--pretty]}}
Print the date and time the system booted up at:
uptime {{[-s|--since]}}
Display version:
uptime {{[-V|--version]}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
users
Options
Examples
Print logged in usernames:
users
Print logged in usernames according to a given file:
users {{/var/log/wmtp}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
vdir
Options
--help
ls-help-print-help
--format
ls-help-set-display-format
-C
ls-help-display-files-columns
--long
,-l
ls-help-display-detailed-info
-x
ls-help-list-entries-rows
--tabsize=<COLS>
,-T <COLS>
ls-help-assume-tab-stops
-m
ls-help-list-entries-commas
--zero
ls-help-list-entries-nul
--dired
,-D
ls-help-generate-dired-output
--hyperlink=<WHEN>
ls-help-hyperlink-filenames
-1
ls-help-list-one-file-per-line
-o
ls-help-long-format-no-group
-g
ls-help-long-no-owner
--numeric-uid-gid
,-n
ls-help-long-numeric-uid-gid
--quoting-style
ls-help-set-quoting-style
--literal
,-N
ls-help-literal-quoting-style
--escape
,-b
ls-help-escape-quoting-style
--quote-name
,-Q
ls-help-c-quoting-style
--hide-control-chars
,-q
ls-help-replace-control-chars
--show-control-chars
ls-help-show-control-chars
--time=<field>
ls-help-show-time-field
-c
ls-help-time-change
-u
ls-help-time-access
--hide=<PATTERN>
ls-help-hide-pattern
--ignore=<PATTERN>
,-I <PATTERN>
ls-help-ignore-pattern
--ignore-backups
,-B
ls-help-ignore-backups
--sort=<field>
ls-help-sort-by-field
-S
ls-help-sort-by-size
-t
ls-help-sort-by-time
-v
ls-help-sort-by-version
-X
ls-help-sort-by-extension
-U
ls-help-sort-none
--dereference
,-L
ls-help-dereference-all
--dereference-command-line-symlink-to-dir
ls-help-dereference-dir-args
--dereference-command-line
,-H
ls-help-dereference-args
--no-group
,-G
ls-help-no-group
--author
ls-help-author
--all
,-a
ls-help-all-files
--almost-all
,-A
ls-help-almost-all
--directory
,-d
ls-help-directory
--human-readable
,-h
ls-help-human-readable
--kibibytes
,-k
ls-help-kibibytes
--si
ls-help-si
--block-size=<BLOCK_SIZE>
ls-help-block-size
--inode
,-i
ls-help-print-inode
--reverse
,-r
ls-help-reverse-sort
--recursive
,-R
ls-help-recursive
--width=<COLS>
,-w <COLS>
ls-help-terminal-width
--size
,-s
ls-help-allocation-size
--color
ls-help-color-output
--indicator-style
ls-help-indicator-style
--classify=<when>
,-F <when>
ls-help-classify
--file-type
ls-help-file-type
-p
ls-help-slash-directories
--time-style=<TIME_STYLE>
ls-help-time-style
--full-time
ls-help-full-time
--context
,-Z
ls-help-context
--group-directories-first
ls-help-group-directories-first
Examples
List files and directories in the current directory, one per line, with details:
vdir
List with sizes displayed in human-readable units (KB, MB, GB):
vdir {{[-h|--human-readable]}}
List including hidden files (starting with a dot):
vdir {{[-a|--all]}}
List files and directories sorting entries by size (largest first):
vdir -S
List files and directories sorting entries by modification time (newest first):
vdir -t
List grouping directories first:
vdir --group-directories-first
Recursively list all files and directories in a specific directory:
vdir {{[-R|--recursive]}} {{path/to/directory}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
wc
Options
--bytes
,-c
wc-help-bytes
--chars
,-m
wc-help-chars
--files0-from=<F>
wc-help-files0-from
--lines
,-l
wc-help-lines
--max-line-length
,-L
wc-help-max-line-length
--total=<WHEN>
wc-help-total
--words
,-w
wc-help-words
Examples
Count all lines in a file:
wc {{[-l|--lines]}} {{path/to/file}}
Count all words in a file:
wc {{[-w|--words]}} {{path/to/file}}
Count all bytes in a file:
wc {{[-c|--bytes]}} {{path/to/file}}
Count all characters in a file (taking multi-byte characters into account):
wc {{[-m|--chars]}} {{path/to/file}}
Count all lines, words and bytes fromstdin
:
{{find .}} | wc
Count the length of the longest line in number of characters:
wc {{[-L|--max-line-length]}} {{path/to/file}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
who
Options
--all
,-a
who-help-all
--boot
,-b
who-help-boot
--dead
,-d
who-help-dead
--heading
,-H
who-help-heading
--login
,-l
who-help-login
--lookup
who-help-lookup
-m
who-help-only-hostname-user
--process
,-p
who-help-process
--count
,-q
who-help-count
--runlevel
,-r
who-help-runlevel
--short
,-s
who-help-short
--time
,-t
who-help-time
--users
,-u
who-help-users
--mesg
,--message
,--writable
,-T
,-w
who-help-mesg
Examples
Display the username, line, and time of all currently logged-in sessions:
who
Display all available information:
who {{[-a|--all]}}
Display all available information with table headers:
who {{[-aH|--all --heading]}}
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
whoami
Options
Examples
Display currently logged username:
whoami
Display the username after a change in the user ID:
sudo whoami
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
yes
Options
Examples
Repeatedly output "message":
yes {{message}}
Repeatedly output "y":
yes
Accept everything prompted by theapt-get
command:
yes | sudo apt-get install {{program}}
Repeatedly output a newline to always accept the default option of a prompt:
yes ''
The examples are provided by thetldr-pages project under theCC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.