uutils Coreutils Documentation
uutils is an attempt at writing universal (as in cross-platform) CLI utilities in Rust. It is available for Linux, Windows, Mac and other platforms.
The API reference for uucore
, the library of functions shared between various
utils, is hosted at docs.rs.
uutils is licensed under the MIT License.
Useful links
Note: This manual is automatically generated from the source code and is a work 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 contain patches.
You can also build uutils from source.
Cargo
# Linux
cargo install coreutils --features unix
# MacOs
cargo install coreutils --features macos
# Windows
cargo install coreutils --features windows
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
Gentoo
emerge -pv sys-apps/uutils-coreutils
Manjaro
pacman -S uutils-coreutils
# or
pamac install uutils-coreutils
NixOS
nix-env -iA nixos.uutils-coreutils
OpenMandriva Lx
dnf install uutils-coreutils
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.
Clone poky and meta-openembedded, add
meta-openembedded/meta-oe
as layer in your build/conf/bblayers.conf
file,
and then either call bitbake uutils-coreutils
, or use
PREFERRED_PROVIDER_coreutils = "uutils-coreutils"
in your build/conf/local.conf
file and
then build your usual yocto image.
Non-standard packages
coreutils-hybrid
(AUR)
A GNU coreutils / uutils coreutils hybrid package. Uses stable uutils programs mixed with GNU counterparts if uutils counterpart is unfinished or buggy.
Build from source
Requirements
- Rust (
cargo
,rustc
) - GNU Make (optional)
Rust Version
uutils follows Rust's release channels and is tested against stable, beta and
nightly. The current Minimum Supported Rust Version (MSRV) is 1.77.0
.
Building
There are currently two methods to build the uutils binaries: either Cargo or GNU Make.
Building the full package, including all documentation, requires both Cargo and Gnu Make on a Unix platform.
For either method, we first need to fetch the repository:
git clone https://github.com/uutils/coreutils
cd coreutils
Cargo
Building uutils using Cargo is easy because the process is the same as for every other Rust program:
cargo build --release
This command builds the most portable common core set of uutils into a multicall (BusyBox-type) binary, named 'coreutils', on most Rust-supported platforms.
Additional platform-specific uutils are often available. Building these expanded sets of uutils for a platform (on that platform) is as simple as specifying it as a feature:
cargo build --release --features macos
# or ...
cargo build --release --features windows
# or ...
cargo build --release --features unix
If you don't want to build every utility available on your platform into the final binary, you can also specify which ones you want to build manually. For example:
cargo build --features "base32 cat echo rm" --no-default-features
If you don't want to build the multicall binary and would prefer to build the
utilities as individual binaries, that is also possible. Each utility is
contained in its own package within the main repository, named "uu_UTILNAME". To
build individual utilities, use cargo to build just the specific packages (using
the --package
[aka -p
] option). For example:
cargo build -p uu_base32 -p uu_cat -p uu_echo -p uu_rm
GNU Make
Building using make
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's bin folder (e.g.
$HOME/.cargo/bin
).
This does not install files necessary for shell completion or manpages. For
manpages or shell completion to work, use GNU Make
or see
Manually install shell completions
/Manually install manpages
.
Install with GNU Make
To install all available utilities:
make install
To install using sudo
switch -E
must be used:
sudo -E make install
To install all but a few of the available utilities:
make SKIP_UTILS='UTILITY_1 UTILITY_2' install
To install only a few of the available utilities:
make UTILS='UTILITY_1 UTILITY_2' install
To install every program with a prefix (e.g. uu-echo uu-cat):
make PROG_PREFIX=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 supported
make PREFIX=/my/path install
Installing with make
installs shell completions for all installed utilities
for bash
, fish
and zsh
. Completions for elvish
and powershell
can also
be generated; See Manually install shell completions
.
Manually install shell completions
The coreutils
binary can generate completions for the bash
, elvish
,
fish
, powershell
and zsh
shells. It prints the result to stdout.
The syntax is:
cargo run completion <utility> <shell>
So, to install completions for ls
on bash
to
/usr/local/share/bash-completion/completions/ls
, run:
cargo run completion ls bash > /usr/local/share/bash-completion/completions/ls
Manually install manpages
To generate manpages, the syntax is:
cargo run manpage <utility>
So, to install the manpage for ls
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 used Cargo to install, use Cargo to uninstall. If you used GNU Make to install, use Make to uninstall.
Uninstall with Cargo
To uninstall uutils:
cargo uninstall coreutils
Uninstall with GNU Make
To uninstall all utilities:
make uninstall
To uninstall every program with a set prefix:
make PROG_PREFIX=PREFIX_GOES_HERE uninstall
To uninstall the multicall binary:
make MULTICALL=y uninstall
To uninstall from a custom parent directory:
# DESTDIR is also supported
make PREFIX=/my/path uninstall
Platform support
uutils aims to be as "universal" as possible, meaning that we try to support many platforms. However, it is infeasible for us to guarantee that every platform works. Just like Rust itself, we therefore have multiple tiers of platform support, with different guarantees. We support two tiers of platforms:
- Tier 1: All applicable utils are compiled and tested in CI for these platforms.
- Tier 2: These platforms are supported but not actively tested. We do accept fixes for these platforms.
Note: The tiers are dictated by our CI. We would happily accept a job in 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 on
Windows, because Windows does not have the concept of groups. Below is a full table
detailing which utilities are supported for the tier 1 platforms.
Note that for some utilities, not all functionality is supported on each platform. 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 explains everything you need to know to contribute. Before you start make sure to also check out these documents:
- Our community's CODE_OF_CONDUCT.md.
- DEVELOPMENT.md for setting up your development environment.
Now follows a very important warning:
[!WARNING] uutils is original code and cannot contain any code from GNU or other implementations. This means that we cannot accept any changes based on the GNU source code. To make sure that cannot happen, you cannot link to the GNU source code either. It is however possible to look at other implementations under a BSD or MIT license like Apple's implementation or OpenBSD.
Finally, feel free to join our Discord!
Getting Oriented
uutils is a big project consisting of many parts. Here are the most important parts for getting started:
src/uu
: The code for all utilitiessrc/uucore
: Crate containing all the shared code between the utilities.tests/by-util
: The tests for all utilities.src/bin/coreutils.rs
: Code for the multicall binary.docs
: the documentation for the website
Each utility is defined as a separate crate. The structure of each of these crates 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 for use by others:
Design Goals
We have the following goals with our development:
- Compatible: The utilities should be a drop-in replacement for the GNU coreutils.
- Cross-platform: All utilities should run on as many of the supported platforms as possible.
- Reliable: The utilities should never unexpectedly fail.
- Performant: Our utilities should be written in fast idiomatic Rust. We aim to match or exceed the performance of the GNU utilities.
- Well-tested: We should have a lot of tests to be able to guarantee reliability and compatibility.
How to Help
There are several ways to help and writing code is just one of them. Reporting issues 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! Here are 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 been reported.
- 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 that could 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 with the maintainers beforehand. We want to avoid situations where you put a lot of work into a fix that we can't merge! If there's no issue for what you're trying to fix yet, make one before 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 using info <utility>
). It is more in depth than the man pages and
provides a good description of available features and their implementation
details. But remember, you cannot look at the GNU source code!
Also remember that we can only merge PRs which pass our test suite, follow rustfmt, and do not have any warnings from clippy. See DEVELOPMENT.md for more information. Be sure to also read about our Rust style.
Our Rust Style
We want uutils to be written in idiomatic Rust, so here are some guidelines to follow. Some of these are aspirational, meaning that we don't do them correctly everywhere in the code. If you find violations of the advice below, feel free to submit a patch!
Don't panic!
The coreutils should be very reliable. This means that we should never panic!
.
Therefore, you should avoid using .unwrap()
and panic!
. Sometimes the use of
unreachable!
can be justified with a comment explaining why that code is
unreachable.
Don't exit
We want uutils to be embeddable in other programs. This means that no function
in uutils should exit the program. Doing so would also lead to code with more
confusing control flow. Avoid therefore std::process::exit
and similar
functions which exit the program early.
unsafe
uutils cannot be entirely safe, because we have to call out to libc
and do
syscalls. However, we still want to limit our use of unsafe
. We generally only
accept unsafe
for FFI, with very few exceptions. Note that performance is very
rarely a valid argument for using unsafe
.
If you still need to write code with unsafe
, make sure to read the
Rustonomicon and annotate the
calls with // SAFETY:
comments explaining why the use of unsafe
is sound.
Macros
Macros can be a great tool, but they are also usually hard to understand. They should be used sparingly. Make sure to explore simpler options before you reach for a solution involving macros.
str
, OsStr
& Path
Rust has many string-like types, and sometimes it's hard to choose the right
one. It's tempting to use str
(and String
) for everything, but that is not
always 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 valid
UTF-8! Whenever we are dealing with paths, we should therefore stick with
OsStr
and Path
. Make sure that you only convert to str
/String
if you
know that something is always valid UTF-8. If you need more operations on
OsStr
, you can use the bstr
crate.
Doc-comments
We use rustdoc for our documentation, so it's best to follow rustdoc's guidelines. Make sure that your documentation is not just repeating the name of the function, but actually giving more useful information. Rustdoc recommends the following 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 to explain the code, not to describe the code. Try to focus on explaining why the code is the way it is. If you feel like you have to describe the code, that's usually a sign that you could improve the naming of variables and functions.
If you edit a piece of code, make sure to update any comments that need to change as a result. The only thing worse than having no comments is having outdated 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 changes much harder to review. If you do need to move things around, do that in a separate commit.
Commit messages
You can read this section in the Git book to learn how to write good commit messages.
In addition, here are a few examples for a summary line when committing to uutils:
- 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 for non-utility modules include:
README: add help
uucore: add new modules
uutils: add new utility
gitignore: 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 to get 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 conflicts
on 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 do so if you don't get a response within a few days.
Platforms
We take pride in supporting many operating systems and architectures. Any code
you contribute must at least compile without warnings for all platforms in the
CI. However, you can use #[cfg(...)]
attributes to create platform dependent
features.
Tip: For Windows, Microsoft provides some images (VMWare, Hyper-V, VirtualBox and Parallels) for development here.
Improving the GNU compatibility
Please make sure you have installed GNU utils and prerequisites and can execute commands described in Comparing with GNU section of DEVELOPMENT.md
The Python script ./util/remaining-gnu-error.py
shows the list of failing
tests 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 or
is easy to understand. You can use the
./util/remaining-gnu-error.py
script to 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 the test 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 new test 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 follow Code coverage report section of DEVELOPMENT.md
Other implementations
The Coreutils have different implementations, with different levels of completions:
However, when reimplementing the tools/options in Rust, don't read their source codes when they are using reciprocal licenses (ex: GNU GPL, GNU LGPL, etc).
Licensing
uutils is distributed under the terms of the MIT License; see the LICENSE
file
for details. This is a permissive license, which allows the software to be used
with few restrictions.
Copyrights in the uutils project are retained by their contributors, and no copyright assignment is required to contribute.
If you wish to add or change dependencies as part of a contribution to the
project, a tool like cargo-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 a popular 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, please raise an issue to describe the dependency.
GNU Test Coverage
uutils is actively tested against the GNU coreutils test suite. The results below are automatically updated every day.
Coverage per category
Click on the categories to see the names of the tests. Green indicates a passing test, yellow indicates a skipped test and red means that the test either failed or resulted in an error.
Progress over time
Extensions over GNU
Though the main goal of the project is compatibility, uutils supports a few features that are not supported by GNU coreutils. We take care not to introduce features that are incompatible with the GNU coreutils. Below is a list of uutils extensions.
General
GNU coreutils provides two ways to define short options taking an argument:
$ ls -w 80
$ ls -w80
We support a third way:
$ ls -w=80
env
env
has an additional -f
/--file
flag that can parse .env
files and set
variables accordingly. This feature is adopted from dotenv
style packages.
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 that
supports computing the checksums with several algorithms. The flags and options
are 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 both
the b2sum
utility of GNU and the
b3sum
utility by the BLAKE3 team and
supports the --no-names
option that does not appear in the GNU util.
more
We provide a simple implementation of more
, which is not part of GNU
coreutils. We do not aim for full compatibility with the more
utility from
util-linux
. Features from more modern pagers (like less
and bat
) are
therefore welcomed.
cut
cut
can separate fields by whitespace (Space and Tab) with -w
flag. This
feature is adopted from FreeBSD.
fmt
fmt
has additional flags for prefixes: -P
/--skip-prefix
, -x
/--exact-prefix
, and
-X
/--exact-skip-prefix
. With -m
/--preserve-headers
, an attempt is made to detect and preserve
mail headers in the input. -q
/--quick
breaks lines more quickly. And -T
/--tab-width
defines the
number of spaces representing a tab when determining the line length.
seq
seq
provides -t
/--terminator
to set the terminator character.
ls
GNU ls
provides two ways to use a long listing format: -l
and --format=long
. We support a
third way: --long
.
GNU ls --sort=VALUE
only supports special non-default sort orders.
We support --sort=name
, which makes it possible to override an earlier value.
du
du
allows birth
and creation
as values for the --time
argument to show the creation time. It
also 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.
Multi-call binary
uutils includes a multi-call binary from which the utils can be invoked. This reduces the binary size of the binary and can be useful for portability.
The first argument of the multi-call binary is the util to run, after which the regular arguments to the util can be passed.
coreutils [util] [util options]
The --help
flag will print a list of available utils.
Example
coreutils ls -l
arch
arch
Display machine architecture
Options
Determine architecture name for current machine.
Examples
Display the system's architecture:
arch
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
b2sum
Options
--binary
,-b
-
read in binary mode
--check
,-c
-
read hashsums from the FILEs and check them
--tag
-
create a BSD-style checksum
--text
,-t
-
read in text mode (default)
--quiet
,-q
-
don't print OK for each successfully verified file
--status
,-s
-
don't output anything, status code shows success
--strict
-
exit non-zero for improperly formatted checksum lines
--ignore-missing
-
don't fail or report status for missing files
--warn
,-w
-
warn about improperly formatted checksum lines
--zero
,-z
-
end each output line with NUL, not newline
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 from stdin
:
{{command}} | b2sum
Read a file of BLAKE2 sums and filenames and verify all files have matching checksums:
b2sum --check {{path/to/file.b2}}
Only show a message for missing files or when verification fails:
b2sum --check --quiet {{path/to/file.b2}}
Only show a message when verification fails, ignoring missing files:
b2sum --ignore-missing --check --quiet {{path/to/file.b2}}
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
b3sum
Options
--binary
,-b
-
read in binary mode
--check
,-c
-
read hashsums from the FILEs and check them
--tag
-
create a BSD-style checksum
--text
,-t
-
read in text mode (default)
--quiet
,-q
-
don't print OK for each successfully verified file
--status
,-s
-
don't output anything, status code shows success
--strict
-
exit non-zero for improperly formatted checksum lines
--ignore-missing
-
don't fail or report status for missing files
--warn
,-w
-
warn about improperly formatted checksum lines
--zero
,-z
-
end each output line with NUL, not newline
--no-names
-
Omits filenames in the output (option not present in GNU/Coreutils)
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 from stdin
:
{{command}} | b3sum
Read a file of BLAKE3 sums and filenames and verify all files have matching checksums:
b3sum --check {{path/to/file.b3}}
Only show a message for missing files or when verification fails:
b3sum --check --quiet {{path/to/file.b3}}
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
base32
base32 [OPTION]... [FILE]
encode/decode data and print to standard output With no FILE, or when FILE is -, read standard input.
The data are encoded as described for the base32 alphabet in RFC 4648. When decoding, the input may contain newlines in addition to the bytes of the formal base32 alphabet. Use --ignore-garbage to attempt to recover from any other non-alphabet bytes in the encoded stream.
Options
--decode
,-d
-
decode data
--ignore-garbage
,-i
-
when decoding, ignore non-alphabetic characters
--wrap=<COLS>
,-w <COLS>
-
wrap encoded lines after COLS character (default 76, 0 to disable wrapping)
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 from stdin
:
{{command}} | base32
Decode from stdin
:
{{command}} | base32 {{-d|--decode}}
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
base64
base64 [OPTION]... [FILE]
encode/decode data and print to standard output With no FILE, or when FILE is -, read standard input.
The data are encoded as described for the base64 alphabet in RFC 3548. When decoding, the input may contain newlines in addition to the bytes of the formal base64 alphabet. Use --ignore-garbage to attempt to recover from any other non-alphabet bytes in the encoded stream.
Options
--decode
,-d
-
decode data
--ignore-garbage
,-i
-
when decoding, ignore non-alphabetic characters
--wrap=<COLS>
,-w <COLS>
-
wrap encoded lines after COLS character (default 76, 0 to disable wrapping)
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 from stdin
:
{{command}} | base64
Decode from stdin
:
{{command}} | base64 {{-d|--decode}}
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
basename
basename [-z] NAME [SUFFIX]
basename OPTION... NAME...
Print NAME with any leading directory components removed If specified, also remove a trailing SUFFIX
Options
--multiple
,-a
-
support multiple arguments and treat each as a NAME
--suffix=<SUFFIX>
,-s <SUFFIX>
-
remove a trailing SUFFIX; implies -a
--zero
,-z
-
end each output line with NUL, not newline
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 the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
basenc
basenc [OPTION]... [FILE]
Encode/decode data and print to standard output With no FILE, or when FILE is -, read standard input.
When decoding, the input may contain newlines in addition to the bytes of the formal alphabet. Use --ignore-garbage to attempt to recover from any other non-alphabet bytes in the encoded stream.
Options
--decode
,-d
-
decode data
--ignore-garbage
,-i
-
when decoding, ignore non-alphabetic characters
--wrap=<COLS>
,-w <COLS>
-
wrap encoded lines after COLS character (default 76, 0 to disable wrapping)
--base64
-
same as 'base64' program
--base64url
-
file- and url-safe base64
--base32
-
same as 'base32' program
--base32hex
-
extended hex alphabet base32
--base16
-
hex encoding
--base2lsbf
-
bit string with least significant bit (lsb) first
--base2msbf
-
bit string with most significant bit (msb) first
--z85
-
ascii85-like encoding;
when encoding, input length must be a multiple of 4;
when decoding, input length must be a multiple of 5
Examples
Encode a file with base64 encoding:
basenc --base64 {{path/to/file}}
Decode a file with base64 encoding:
basenc --decode --base64 {{path/to/file}}
Encode from stdin
with base32 encoding with 42 columns:
{{command}} | basenc --base32 -w42
Encode from stdin
with base32 encoding:
{{command}} | basenc --base32
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
cat
cat [OPTION]... [FILE]...
Concatenate FILE(s), or standard input, to standard output With no FILE, or when FILE is -, read standard input.
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 to stdout
:
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}}
Write stdin
to a file:
cat - > {{path/to/file}}
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
chcon
chcon [OPTION]... CONTEXT FILE...
chcon [OPTION]... [-u USER] [-r ROLE] [-l RANGE] [-t TYPE] FILE...
chcon [OPTION]... --reference=RFILE FILE...
Change the SELinux security context of each FILE to CONTEXT. With --reference, change the security context of each FILE to that of RFILE.
Options
--help
-
Print help information.
--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.
--preserve-root
-
Fail to operate recursively on '/'.
--no-preserve-root
-
Do not treat '/' specially (the default).
--reference=<RFILE>
-
Use security context of RFILE, rather than specifying a CONTEXT value.
--user=<USER>
,-u <USER>
-
Set user USER in the target security context.
--role=<ROLE>
,-r <ROLE>
-
Set role ROLE in the target security context.
--type=<TYPE>
,-t <TYPE>
-
Set type TYPE in the target security context.
--range=<RANGE>
,-l <RANGE>
-
Set range RANGE in the target security context.
--recursive
,-R
-
Operate on files and directories recursively.
-H
-
If a command line argument is a symbolic link to a directory, traverse it. Only valid when -R is specified.
-L
-
Traverse every symbolic link to a directory encountered. Only valid when -R is specified.
-P
-
Do not traverse any symbolic links (default). Only valid when -R is specified.
--verbose
,-v
-
Output a diagnostic for every file processed.
Examples
View security context of a file:
ls -lZ {{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}} {{filename}}
Change only the role part of SELinux security context:
chcon -r {{role}} {{filename}}
Change only the type part of SELinux security context:
chcon -t {{type}} {{filename}}
Change only the range/level part of SELinux security context:
chcon -l {{range/level}} {{filename}}
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
chgrp
chgrp [OPTION]... GROUP FILE...
chgrp [OPTION]... --reference=RFILE FILE...
Change the group of each FILE to GROUP.
Options
--help
-
Print help information.
--changes
,-c
-
like verbose but report only when a change is made
--silent
,-f
--quiet
-
suppress most error messages
--verbose
,-v
-
output a diagnostic for every file processed
--dereference
--no-dereference
,-h
-
affect symbolic links instead of any referenced file (useful only on systems that can change the ownership of a symlink)
--preserve-root
-
fail to operate recursively on '/'
--no-preserve-root
-
do not treat '/' specially (the default)
--reference=<RFILE>
-
use RFILE's group rather than specifying GROUP values
--recursive
,-R
-
operate on files and directories recursively
-H
-
if a command line argument is a symbolic link to a directory, traverse it
-P
-
do not traverse any symbolic links (default)
-L
-
traverse every symbolic link to a directory encountered
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 {{group}} {{path/to/directory}}
Change the owner group of a symbolic link:
chgrp -h {{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 the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
chmod
chmod [OPTION]... MODE[,MODE]... FILE...
chmod [OPTION]... OCTAL-MODE FILE...
chmod [OPTION]... --reference=RFILE FILE...
Change the mode of each FILE to MODE. With --reference, change the mode of each FILE to that of RFILE.
Options
--changes
,-c
-
like verbose but report only when a change is made
--quiet
,--silent
,-f
-
suppress most error messages
--verbose
,-v
-
output a diagnostic for every file processed
--no-preserve-root
-
do not treat '/' specially (the default)
--preserve-root
-
fail to operate recursively on '/'
--recursive
,-R
-
change files and directories recursively
--reference
-
use RFILE's mode instead of MODE values
Each MODE is of the form '[ugoa]*(-+=)+|[-+=]?[0-7]+'.
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 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 a+rX {{path/to/directory}}
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
chown
chown [OPTION]... [OWNER][:[GROUP]] FILE...
chown [OPTION]... --reference=RFILE FILE...
Change file owner and group
Options
--help
-
Print help information.
--changes
,-c
-
like verbose but report only when a change is made
--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)
--from=<CURRENT_OWNER:CURRENT_GROUP>
-
change the owner and/or group of each file only if its current owner and/or group match those specified here. Either may be omitted, in which case a match is not required for the omitted attribute
--preserve-root
-
fail to operate recursively on '/'
--no-preserve-root
-
do not treat '/' specially (the default)
--quiet
-
suppress most error messages
--recursive
,-R
-
operate on files and directories recursively
--reference=<RFILE>
-
use RFILE's owner and group rather than specifying OWNER:GROUP values
--silent
,-f
-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)
--verbose
,-v
-
output a diagnostic for every file processed
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 name user
:
chown {{user}}: {{path/to/file_or_directory}}
Recursively change the owner of a directory and its contents:
chown -R {{user}} {{path/to/directory}}
Change the owner of a symbolic link:
chown -h {{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 the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
chroot
chroot [OPTION]... NEWROOT [COMMAND [ARG]...]
Run COMMAND with root directory set to NEWROOT.
Options
--user=<USER>
,-u <USER>
-
User (ID or name) to switch before running the program
--group=<GROUP>
,-g <GROUP>
-
Group (ID or name) to switch to
--groups=<GROUP1,GROUP2...>
,-G <GROUP1,GROUP2...>
-
Comma-separated list of groups to switch to
--userspec=<USER:GROUP>
-
Colon-separated user and group to switch to. Same as -u USER -g GROUP. Userspec has higher preference than -u and/or -g
--skip-chdir
-
Use this option to not change the working directory to / after changing the root directory to newroot, i.e., inside the chroot.
Examples
Run command as new root directory:
chroot {{path/to/new/root}} {{command}}
Use a specific user and group:
chroot --userspec={{username_or_id:group_name_or_id}}
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
cksum
cksum [OPTIONS] [FILE]...
Print CRC and size for each file
Options
--algorithm=<ALGORITHM>
,-a <ALGORITHM>
-
select the digest type to use. See DIGEST below
--untagged
-
create a reversed style checksum, without digest type
--tag
-
create a BSD style checksum, undo --untagged (default)
--length
,-l
-
digest length in bits; must not exceed the max for the blake2 algorithm and must be a multiple of 8
--raw
-
emit a raw binary digest, not hexadecimal
--strict
-
exit non-zero for improperly formatted checksum lines
--check
,-c
-
read hashsums from the FILEs and check them
--base64
-
emit a base64 digest, not hexadecimal
--text
,-t
--binary
,-b
--warn
,-w
-
warn about improperly formatted checksum lines
--status
-
don't output anything, status code shows success
--quiet
-
don't print OK for each successfully verified file
--ignore-missing
-
don't fail or report status for missing files
--zero
,-z
-
end each output line with NUL, not newline,
and disable file name escaping
DIGEST determines the digest algorithm and default output format:
sysv
: (equivalent to sum -s)bsd
: (equivalent to sum -r)crc
: (equivalent to cksum)md5
: (equivalent to md5sum)sha1
: (equivalent to sha1sum)sha224
: (equivalent to sha224sum)sha256
: (equivalent to sha256sum)sha384
: (equivalent to sha384sum)sha512
: (equivalent to sha512sum)blake2b
: (equivalent to b2sum)sm3
: (only available through cksum)
Examples
Display a 32-bit checksum, size in bytes and filename:
cksum {{path/to/file}}
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
comm
comm [OPTION]... FILE1 FILE2
Compare two sorted files line by line.
When FILE1 or FILE2 (not both) is -, read standard input.
With no options, produce three-column output. Column one contains lines unique to FILE1, column two contains lines unique to FILE2, and column three contains lines common to both files.
Options
-1
-
suppress column 1 (lines unique to FILE1)
-2
-
suppress column 2 (lines unique to FILE2)
-3
-
suppress column 3 (lines that appear in both files)
--output-delimiter=<STR>
-
separate columns with STR
--zero-terminated
,-z
-
line delimiter is NUL, not newline
--total
-
output a summary
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 from stdin
:
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 the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
cp
cp [OPTION]... [-T] SOURCE DEST
cp [OPTION]... SOURCE... DIRECTORY
cp [OPTION]... -t DIRECTORY SOURCE...
Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.
Options
--target-directory=<target-directory>
,-t <target-directory>
-
copy all SOURCE arguments into target-directory
--no-target-directory
,-T
-
Treat DEST as a regular file and not a directory
--interactive
,-i
-
ask before overwriting files
--link
,-l
-
hard-link files instead of copying
--no-clobber
,-n
-
don't overwrite a file that already exists
--recursive
,-R
,-r
-
copy directories recursively
--strip-trailing-slashes
-
remove any trailing slashes from each SOURCE argument
--debug
-
explain how a file is copied. Implies -v
--verbose
,-v
-
explicitly state what is being done
--symbolic-link
,-s
-
make symbolic links instead of copying
--force
,-f
-
if an existing destination file cannot be opened, remove it and try again (this option is ignored when the -n option is also used). Currently not implemented for Windows.
--remove-destination
-
remove each existing destination file before attempting to open it (contrast with --force). On Windows, currently only works for writeable files.
--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>
-
control clone/CoW copies. See below
--attributes-only
-
Don't copy the file data, just the attributes
--preserve=<ATTR_LIST>
-
Preserve the specified attributes (default: mode, ownership (unix only), timestamps), if possible additional attributes: context, links, xattr, all
--preserve-default-attributes
,-p
-
same as --preserve=mode,ownership(unix only),timestamps
--no-preserve=<ATTR_LIST>
-
don't preserve the specified attributes
--parents
-
use full source file name under DIRECTORY
--no-dereference
,-P
-
never follow symbolic links in SOURCE
--dereference
,-L
-
always follow symbolic links in SOURCE
-H
-
follow command-line symbolic links in SOURCE
--archive
,-a
-
Same as -dR --preserve=all
-d
-
same as --no-dereference --preserve=links
--one-file-system
,-x
-
stay on this file system
--sparse=<WHEN>
-
control creation of sparse files. See below
--copy-contents
-
NotImplemented: copy contents of special files when recursive
--context=<CTX>
-
NotImplemented: set SELinux security context of destination file to default type
--progress
,-g
-
Display a progress bar.
Note: this feature is not supported by GNU coreutils.
Do not copy a non-directory that has an existing destination with the same or newer modification timestamp;
instead, silently skip the file without failing. If timestamps are being preserved, the comparison is to the
source timestamp truncated to the resolutions of the destination file system and of the system calls used to
update timestamps; this avoids duplicate work if several cp -pu
commands are executed with the same source
and destination. This option is ignored if the -n
or --no-clobber
option is also specified. Also, if
--preserve=links
is also specified (like with cp -au
for example), that will take precedence; consequently,
depending on the order that files are processed from the source, newer files in the destination may be replaced,
to mirror hard links in the source. which gives more control over which existing files in the destination are
replaced, and its value can be one of the following:
all
This is the default operation when an--update
option is not specified, and results in all existing files in the destination being replaced.none
This is similar to the--no-clobber
option, in that no files in the destination are replaced, but also skipping a file does not induce a failure.older
This is the default operation when--update
is specified, and results in files being replaced if they’re older than the corresponding source file.
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 {{path/to/source_directory}} {{path/to/target_directory}}
Copy a directory recursively, in verbose mode (shows files as they are copied):
cp -vR {{path/to/source_directory}} {{path/to/target_directory}}
Copy multiple files at once to a directory:
cp -t {{path/to/destination_directory}} {{path/to/file1 path/to/file2 ...}}
Copy text files to another location, in interactive mode (prompts user before overwriting):
cp -i {{*.txt}} {{path/to/target_directory}}
Follow symbolic links before copying:
cp -L {{link}} {{path/to/target_directory}}
Use the first argument as the destination directory (useful for xargs ... | cp -t <DEST_DIR>
):
cp -t {{path/to/target_directory}} {{path/to/file_or_directory1 path/to/file_or_directory2 ...}}
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
csplit
csplit [OPTION]... FILE PATTERN...
Split a file into sections determined by context lines
Options
--suffix-format=<FORMAT>
,-b <FORMAT>
-
use sprintf FORMAT instead of %02d
--prefix=<PREFIX>
,-f <PREFIX>
-
use PREFIX instead of 'xx'
--keep-files
,-k
-
do not remove output files on errors
--suppress-matched
-
suppress the lines matching PATTERN
--digits=<DIGITS>
,-n <DIGITS>
-
use specified number of digits instead of 2
--quiet
,--silent
,-s
-
do not print counts of output file sizes
--elide-empty-files
,-z
-
remove empty output files
Output pieces of FILE separated by PATTERN(s) to files 'xx00', 'xx01', ..., and output byte counts of each piece to standard output.
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 {{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}}
Split a file at a line matching a regular expression:
csplit {{path/to/file}} /{{regular_expression}}/
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
cut
cut OPTION... [FILE]...
Prints specified byte or field columns from each line of stdin or the input files
Options
--bytes=<LIST>
,-b <LIST>
-
filter byte columns from the input source
--characters=<LIST>
,-c <LIST>
-
alias for character mode
--delimiter=<DELIM>
,-d <DELIM>
-
specify the delimiter character that separates fields in the input source. Defaults to Tab.
-w <WHITESPACE>
-
Use any number of whitespace (Space, Tab) to separate fields in the input source (FreeBSD extension).
--fields=<LIST>
,-f <LIST>
-
filter field columns from the input source
--complement
-
invert the filter - instead of displaying only the filtered columns, display all but those columns
--only-delimited
,-s
-
in field mode, only print lines which contain the delimiter
--zero-terminated
,-z
-
instead of filtering columns based on line, filter columns based on \0 (NULL character)
--output-delimiter=<NEW_DELIM>
-
in field mode, replace the delimiter in output lines with this option's argument
Each call must specify a mode (what to use for columns), a sequence (which columns to print), and provide a data source
Specifying a mode
Use --bytes
(-b
) or --characters
(-c
) to specify byte mode
Use --fields
(-f
) to specify field mode, where each line is broken into
fields identified by a delimiter character. For example for a typical CSV
you could use this in combination with setting comma as the delimiter
Specifying a sequence
A sequence is a group of 1 or more numbers or inclusive ranges separated by a commas.
cut -f 2,5-7 some_file.txt
will display the 2nd, 5th, 6th, and 7th field for each source line
Ranges can extend to the end of the row by excluding the second number
cut -f 3- some_file.txt
will display the 3rd field and all fields after for each source line
The first number of a range can be excluded, and this is effectively the same as using 1 as the first number: it causes the range to begin at the first column. Ranges can also display a single column
cut -f 1,3-5 some_file.txt
will display the 1st, 3rd, 4th, and 5th field for each source line
The --complement
option, when used, inverts the effect of the sequence
cut --complement -f 4-6 some_file.txt
will display the every field but the 4th, 5th, and 6th
Specifying a data source
If no sourcefile
arguments are specified, stdin is used as the source of
lines to print
If sourcefile
arguments are specified, stdin is ignored and all files are
read in consecutively if a sourcefile
is not successfully read, a warning
will print to stderr, and the eventual status code will be 1, but cut
will continue to read through proceeding sourcefiles
To print columns from both STDIN and a file argument, use -
(dash) as a
sourcefile
argument to represent stdin.
Field Mode options
The fields in each line are identified by a delimiter (separator)
Set the delimiter
Set the delimiter which separates fields in the file using the
--delimiter
(-d
) option. Setting the delimiter is optional.
If not set, a default delimiter of Tab will be used.
If the -w
option is provided, fields will be separated by any number
of whitespace characters (Space and Tab). The output delimiter will
be a Tab unless explicitly specified. Only one of -d
or -w
option can be specified.
This is an extension adopted from FreeBSD.
Optionally Filter based on delimiter
If the --only-delimited
(-s
) flag is provided, only lines which
contain the delimiter will be printed
Replace the delimiter
If the --output-delimiter
option is provided, the argument used for
it will replace the delimiter character in each line printed. This is
useful for transforming tabular data - e.g. to convert a CSV to a
TSV (tab-separated file)
Line endings
When the --zero-terminated
(-z
) option is used, cut sees \0 (null) as the
'line ending' character (both for the purposes of reading lines and
separating printed lines) instead of \n (newline). This is useful for
tabular data where some of the cells may contain newlines
echo 'ab\\0cd' | cut -z -c 1
will result in 'a\0c\0'
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 [f]ield range of each line with a specific [d]elimiter:
{{command}} | cut --delimiter "{{,}}" --fields {{1}}
Print a [c]haracter range of each line of the specific file:
cut --characters {{1}} {{path/to/file}}
Print specific [f]ields of NUL
terminated lines (e.g. as in find . -print0
) instead of newlines:
{{command}} | cut --zero-terminated --fields {{1}}
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
date
date [OPTION]... [+FORMAT]...
date [OPTION]... [MMDDhhmm[[CC]YY][.ss]]
Print or set the system date and time
Options
--date=<STRING>
,-d <STRING>
-
display time described by STRING, not 'now'
--file=<DATEFILE>
,-f <DATEFILE>
-
like --date; once for each line of DATEFILE
--iso-8601=<FMT>
,-I <FMT>
-
output date/time in ISO 8601 format.
FMT='date' for date only (the default),
'hours', 'minutes', 'seconds', or 'ns'
for date and time to the indicated precision.
Example: 2006-08-14T02:34:56-06:00 --rfc-email
,-R
-
output date and time in RFC 5322 format.
Example: Mon, 14 Aug 2006 02:34:56 -0600 --rfc-3339=<FMT>
-
output date/time in RFC 3339 format.
FMT='date', 'seconds', or 'ns'
for date and time to the indicated precision.
Example: 2006-08-14 02:34:56-06:00 --debug
-
annotate the parsed date, and warn about questionable usage to stderr
--reference=<FILE>
,-r <FILE>
-
display the last modification time of FILE
--set=<STRING>
,-s <STRING>
-
set time described by STRING
--universal
,-u
-
print or set Coordinated Universal Time (UTC)
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 +%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 @{{1473305798}}
Convert a given date to the Unix timestamp format:
date -d "{{2018-09-01 00:00}}" +%s --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 format MMDDhhmmYYYY.ss
(YYYY
and .ss
are optional):
date {{093023592021.59}}
Display the current ISO week number:
date +%V
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
dd
dd [OPERAND]...
dd OPTION
Copy, and optionally convert, a file system resource
Options
Operands
-
bs=BYTES
: read and write up to BYTES bytes at a time (default: 512); overwritesibs
andobs
. -
cbs=BYTES
: the 'conversion block size' in bytes. Applies to theconv=block
, andconv=unblock
operations. -
conv=CONVS
: a comma-separated list of conversion options or (for legacy reasons) file flags. -
count=N
: stop reading input after N ibs-sized read operations rather than proceeding until EOF. Seeiflag=count_bytes
if stopping after N bytes is preferred -
ibs=N
: the size of buffer used for reads (default: 512) -
if=FILE
: the file used for input. When not specified, stdin is used instead -
iflag=FLAGS
: a comma-separated list of input flags which specify how the input source is treated. FLAGS may be any of the input-flags or general-flags specified below. -
skip=N
(oriseek=N
) : skip N ibs-sized records into input before beginning copy/convert operations. See iflag=seek_bytes if seeking N bytes is preferred. -
obs=N
: the size of buffer used for writes (default: 512) -
of=FILE
: the file used for output. When not specified, stdout is used instead -
oflag=FLAGS
: comma separated list of output flags which specify how the output source is treated. FLAGS may be any of the output flags or general flags specified below -
seek=N
(oroseek=N
) : seeks N obs-sized records into output before beginning copy/convert operations. See oflag=seek_bytes if seeking N bytes is preferred -
status=LEVEL
: controls whether volume and performance stats are written to stderr.When unspecified, dd will print stats upon completion. An example is below.
6+0 records in 16+0 records out 8192 bytes (8.2 kB, 8.0 KiB) copied, 0.00057009 s, 14.4 MB/s
The first two lines are the 'volume' stats and the final line is the 'performance' stats. The volume stats indicate the number of complete and partial ibs-sized reads, or obs-sized writes that took place during the copy. The format of the volume stats is
<complete>+<partial>
. If records have been truncated (seeconv=block
), the volume stats will contain the number of truncated records.Possible LEVEL values are:
progress
: Print periodic performance stats as the copy proceeds.noxfer
: Print final volume stats, but not performance stats.none
: Do not print any stats.
Printing performance stats is also triggered by the INFO signal (where supported), or the USR1 signal. Setting the POSIXLY_CORRECT environment variable to any value (including an empty value) will cause the USR1 signal to be ignored.
Conversion Options
-
ascii
: convert from EBCDIC to ASCII. This is the inverse of theebcdic
option. Impliesconv=unblock
. -
ebcdic
: convert from ASCII to EBCDIC. This is the inverse of theascii
option. Impliesconv=block
. -
ibm
: convert from ASCII to EBCDIC, applying the conventions for[
,]
and~
specified in POSIX. Impliesconv=block
. -
ucase
: convert from lower-case to upper-case. -
lcase
: converts from upper-case to lower-case. -
block
: for each newline less than the size indicated by cbs=BYTES, remove the newline and pad with spaces up to cbs. Lines longer than cbs are truncated. -
unblock
: for each block of input of the size indicated by cbs=BYTES, remove right-trailing spaces and replace with a newline character. -
sparse
: attempts to seek the output when an obs-sized block consists of only zeros. -
swab
: swaps each adjacent pair of bytes. If an odd number of bytes is present, the final byte is omitted. -
sync
: pad each ibs-sided block with zeros. Ifblock
orunblock
is specified, pad with spaces instead. -
excl
: the output file must be created. Fail if the output file is already present. -
nocreat
: the output file will not be created. Fail if the output file in not already present. -
notrunc
: the output file will not be truncated. If this option is not present, output will be truncated when opened. -
noerror
: all read errors will be ignored. If this option is not present, dd will only ignore Error::Interrupted. -
fdatasync
: data will be written before finishing. -
fsync
: data and metadata will be written before finishing.
Input flags
count_bytes
: a value tocount=N
will be interpreted as bytes.skip_bytes
: a value toskip=N
will be interpreted as bytes.fullblock
: wait for ibs bytes from each read. zero-length reads are still considered EOF.
Output flags
append
: open file in append mode. Consider setting conv=notrunc as well.seek_bytes
: a value to seek=N will be interpreted as bytes.
General Flags
direct
: use direct I/O for data.directory
: fail unless the given input (if used as an iflag) or output (if used as an oflag) is a directory.dsync
: use synchronized I/O for data.sync
: use synchronized I/O for data and metadata.nonblock
: use non-blocking I/O.noatime
: do not update access time.nocache
: request that OS drop cache.noctty
: do not assign a controlling tty.nofollow
: do not follow system links.
Examples
Make a bootable USB drive from an isohybrid file (such as archlinux-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 swapping if
and of
), and show the progress:
dd if={{/dev/drive_device}} of={{path/to/file.img}} status=progress
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
df
df [OPTION]... [FILE]...
Show information about the file system on which each FILE resides, or all file systems by default.
Options
--help
-
Print help information.
--all
,-a
-
include dummy file systems
--block-size=<SIZE>
,-B <SIZE>
-
scale sizes by SIZE before printing them; e.g.'-BM' prints sizes in units of 1,048,576 bytes
--total
-
produce a grand total
--human-readable
,-h
-
print sizes in human readable format (e.g., 1K 234M 2G)
--si
,-H
-
likewise, but use powers of 1000 not 1024
--inodes
,-i
-
list inode information instead of block usage
-k
-
like --block-size=1K
--local
,-l
-
limit listing to local file systems
--no-sync
-
do not invoke sync before getting usage info (default)
--output=<FIELD_LIST>
-
use the output format defined by FIELD_LIST, or print all fields if FIELD_LIST is omitted.
--portability
,-P
-
use the POSIX output format
--sync
-
invoke sync before getting usage info (non-windows only)
--type=<TYPE>
,-t <TYPE>
-
limit listing to file systems of type TYPE
--print-type
,-T
-
print file system type
--exclude-type=<TYPE>
,-x <TYPE>
-
limit listing to file systems not of type TYPE
Display values are in units of the first available SIZE from --block-size, and the DF_BLOCK_SIZE, BLOCK_SIZE and BLOCKSIZE environment variables. Otherwise, units default to 1024 bytes (or 512 if POSIXLY_CORRECT is set).
SIZE is an integer and optional unit (example: 10M is 1010241024). Units are K, M, G, T, P, E, Z, Y (powers of 1024) or KB, MB,... (powers of 1000).
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 the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
dir
Options
--help
-
Print help information.
--format
-
Set the display format.
-C
-
Display the files in columns.
--long
,-l
-
Display detailed information.
-x
-
List entries in rows instead of in columns.
--tabsize=<COLS>
,-T <COLS>
-
Assume tab stops at each COLS instead of 8 (unimplemented)
-m
-
List entries separated by commas.
--zero
-
List entries separated by ASCII NUL characters.
--dired
,-D
-
generate output designed for Emacs' dired (Directory Editor) mode
--hyperlink=<WHEN>
-
hyperlink file names WHEN
-1
-
List one file per line.
-o
-
Long format without group information. Identical to --format=long with --no-group.
-g
-
Long format without owner information.
--numeric-uid-gid
,-n
-
-l with numeric UIDs and GIDs.
--quoting-style
-
Set quoting style.
--literal
,-N
-
Use literal quoting style. Equivalent to
--quoting-style=literal
--escape
,-b
-
Use escape quoting style. Equivalent to
--quoting-style=escape
--quote-name
,-Q
-
Use C quoting style. Equivalent to
--quoting-style=c
--hide-control-chars
,-q
-
Replace control characters with '?' if they are not escaped.
--show-control-chars
-
Show control characters 'as is' if they are not escaped.
--time=<field>
-
Show time in
:
access time (-u): atime, access, use;
change time (-t): ctime, status.
birth time: birth, creation; -c
-
If the long listing format (e.g., -l, -o) is being used, print the status change time (the 'ctime' in the inode) instead of the modification time. When explicitly sorting by time (--sort=time or -t) or when not using a long listing format, sort according to the status change time.
-u
-
If the long listing format (e.g., -l, -o) is being used, print the status access time instead of the modification time. When explicitly sorting by time (--sort=time or -t) or when not using a long listing format, sort according to the access time.
--hide=<PATTERN>
-
do not list implied entries matching shell PATTERN (overridden by -a or -A)
--ignore=<PATTERN>
,-I <PATTERN>
-
do not list implied entries matching shell PATTERN
--ignore-backups
,-B
-
Ignore entries which end with ~.
--sort=<field>
-
Sort by
: name, none (-U), time (-t), size (-S), extension (-X) or width -S
-
Sort by file size, largest first.
-t
-
Sort by modification time (the 'mtime' in the inode), newest first.
-v
-
Natural sort of (version) numbers in the filenames.
-X
-
Sort alphabetically by entry extension.
-U
-
Do not sort; list the files in whatever order they are stored in the directory. This is especially useful when listing very large directories, since not doing any sorting can be noticeably faster.
--dereference
,-L
-
When showing file information for a symbolic link, show information for the file the link references rather than the link itself.
--dereference-command-line-symlink-to-dir
-
Do not follow symlinks except when they link to directories and are given as command line arguments.
--dereference-command-line
,-H
-
Do not follow symlinks except when given as command line arguments.
--no-group
,-G
-
Do not show group in long format.
--author
-
Show author in long format. On the supported platforms, the author always matches the file owner.
--all
,-a
-
Do not ignore hidden files (files with names that start with '.').
--almost-all
,-A
-
In a directory, do not ignore all file names that start with '.', only ignore '.' and '..'.
--directory
,-d
-
Only list the names of directories, rather than listing directory contents. This will not follow symbolic links unless one of
--dereference-command-line (-H)
,--dereference (-L)
, or--dereference-command-line-symlink-to-dir
is specified. --human-readable
,-h
-
Print human readable file sizes (e.g. 1K 234M 56G).
--kibibytes
,-k
-
default to 1024-byte blocks for file system usage; used only with -s and per directory totals
--si
-
Print human readable file sizes using powers of 1000 instead of 1024.
--block-size=<BLOCK_SIZE>
-
scale sizes by BLOCK_SIZE when printing them
--inode
,-i
-
print the index number of each file
--reverse
,-r
-
Reverse whatever the sorting method is e.g., list files in reverse alphabetical order, youngest first, smallest first, or whatever.
--recursive
,-R
-
List the contents of all directories recursively.
--width=<COLS>
,-w <COLS>
-
Assume that the terminal is COLS columns wide.
--size
,-s
-
print the allocated size of each file, in blocks
--color
-
Color output based on file type.
--indicator-style
-
Append indicator with style WORD to entry names: none (default), slash (-p), file-type (--file-type), classify (-F)
--classify=<when>
,-F <when>
-
Append a character to each file name indicating the file type. Also, for regular files that are executable, append '*'. The file type indicators are '/' for directories, '@' for symbolic links, '|' for FIFOs, '=' for sockets, '>' for doors, and nothing for regular files. when may be omitted, or one of:
none - Do not classify. This is the default.
auto - Only classify if standard output is a terminal.
always - Always classify.
Specifying --classify and no when is equivalent to --classify=always. This will not follow symbolic links listed on the command line unless the --dereference-command-line (-H), --dereference (-L), or --dereference-command-line-symlink-to-dir options are specified. --file-type
-
Same as --classify, but do not append '*'
-p
-
Append / indicator to directories.
--time-style=<TIME_STYLE>
-
time/date format with -l; see TIME_STYLE below
--full-time
-
like -l --time-style=full-iso
--context
,-Z
-
print any security context of each file
--group-directories-first
-
group directories before files; can be augmented with a --sort option, but any use of --sort=none (-U) disables grouping
Examples
List all files, including hidden files:
dir --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 --recursive
Display help:
dir --help
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
dircolors
dircolors [OPTION]... [FILE]
Output commands to set the LS_COLORS environment variable.
Options
--sh
,--bourne-shell
,-b
-
output Bourne shell code to set LS_COLORS
--csh
,--c-shell
,-c
-
output C shell code to set LS_COLORS
--print-database
,-p
-
print the byte counts
--print-ls-colors
-
output fully escaped colors for display
If FILE is specified, read it to determine which colors to use for which file types and extensions. Otherwise, a precompiled database is used. For details on the format of these files, run 'dircolors --print-database'
Examples
Output commands to set LS_COLOR using default colors:
dircolors
Display each filetype with the color they would appear in ls
:
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 --bourne-shell
Output commands for C shell:
dircolors --c-shell
View the default colors for file types and extensions:
dircolors --print-data
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
dirname
dirname [OPTION] NAME...
Strip last component from file name
Options
--zero
,-z
-
separate output with NUL rather than newline
Output each NAME with its last non-slash component and trailing slashes removed; if NAME contains no /'s, output '.' (meaning the current directory).
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 with xargs
):
dirname --zero {{path/to/file_or_directory1 path/to/file_or_directory2 ...}}
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
du
du [OPTION]... [FILE]...
du [OPTION]... --files0-from=F
Estimate file space usage
Options
--help
-
Print help information.
--all
,-a
-
write counts for all files, not just directories
--apparent-size
-
print apparent sizes, rather than disk usage although the apparent size is usually smaller, it may be larger due to holes in ('sparse') files, internal fragmentation, indirect blocks, and the like
--block-size=<SIZE>
,-B <SIZE>
-
scale sizes by SIZE before printing them. E.g., '-BM' prints sizes in units of 1,048,576 bytes. See SIZE format below.
--bytes
,-b
-
equivalent to '--apparent-size --block-size=1'
--total
,-c
-
produce a grand total
--max-depth=<N>
,-d <N>
-
print the total for a directory (or file, with --all) only if it is N or fewer levels below the command line argument; --max-depth=0 is the same as --summarize
--human-readable
,-h
-
print sizes in human readable format (e.g., 1K 234M 2G)
--inodes
-
list inode usage information instead of block usage like --block-size=1K
-k
-
like --block-size=1K
--count-links
,-l
-
count sizes many times if hard linked
--dereference
,-L
-
follow all symbolic links
--dereference-args
,-D
,-H
-
follow only symlinks that are listed on the command line
--no-dereference
,-P
-
don't follow any symbolic links (this is the default)
-m
-
like --block-size=1M
--null
,-0
-
end each output line with 0 byte rather than newline
--separate-dirs
,-S
-
do not include size of subdirectories
--summarize
,-s
-
display only a total for each argument
--si
-
like -h, but use powers of 1000 not 1024
--one-file-system
,-x
-
skip directories on different file systems
--threshold=<SIZE>
,-t <SIZE>
-
exclude entries smaller than SIZE if positive, or entries greater than SIZE if negative
--verbose
,-v
-
verbose mode (option not present in GNU/Coreutils)
--exclude=<PATTERN>
-
exclude files that match PATTERN
--exclude-from=<FILE>
,-X <FILE>
-
exclude files that match any pattern in FILE
--files0-from=<FILE>
-
summarize device usage of the NUL-terminated file names specified in file F; if F is -, then read names from standard input
--time=<WORD>
-
show time of the last modification of any file in the directory, or any of its subdirectories. If WORD is given, show time as WORD instead of modification time: atime, access, use, ctime, status, birth or creation
--time-style=<STYLE>
-
show times using style STYLE: full-iso, long-iso, iso, +FORMAT FORMAT is interpreted like 'date'
Display values are in units of the first available SIZE from --block-size, and the DU_BLOCK_SIZE, BLOCK_SIZE and BLOCKSIZE environment variables. Otherwise, units default to 1024 bytes (or 512 if POSIXLY_CORRECT is set).
SIZE is an integer and optional unit (example: 10M is 1010241024). Units are K, M, G, T, P, E, Z, Y (powers of 1024) or KB, MB,... (powers of 1000).
PATTERN allows some advanced exclusions. For example, the following syntaxes
are supported:
?
will match only one character
*
will match zero or more characters
{a,b}
will match a or b
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 {{path/to/directory}}
Show the size of a single directory, in human-readable units:
du -sh {{path/to/directory}}
List the human-readable sizes of a directory and of all the files and directories within it:
du -ah {{path/to/directory}}
List the human-readable sizes of a directory and any subdirectories, up to N levels deep:
du -h --max-depth=N {{path/to/directory}}
List the human-readable size of all .jpg
files in subdirectories of the current directory, and show a cumulative total at the end:
du -ch {{*/*.jpg}}
List all files and directories (including hidden ones) above a certain [t]hreshold size (useful for investigating what is actually taking up the space):
du --all --human-readable --threshold {{1G|1024M|1048576K}} .[^.]* *
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
echo
echo [OPTIONS]... [STRING]...
Display a line of text
Options
-n
-
do not output the trailing newline
-e
-
enable interpretation of backslash escapes
-E
-
disable interpretation of backslash escapes (default)
Echo the STRING(s) to standard output.
If -e is in effect, the following sequences are recognized:
\
backslash\a
alert (BEL)\b
backspace\c
produce no further output\e
escape\f
form feed\n
new line\r
carriage return\t
horizontal tab\v
vertical tab\0NNN
byte with octal value NNN (1 to 3 digits)\xHH
byte with hexadecimal value HH (1 to 2 digits)
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 are echo %errorlevel%
and $lastexitcode
respectively):
echo $?
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
env
env [OPTION]... [-] [NAME=VALUE]... [COMMAND [ARG]...]
Set each NAME to VALUE in the environment and run COMMAND
Options
--ignore-environment
,-i
-
start with an empty environment
--chdir=<DIR>
,-C <DIR>
-
change working directory to DIR
--null
,-0
-
end each output line with a 0 byte rather than a newline (only valid when printing the environment)
--file=<PATH>
,-f <PATH>
-
read and set variables from a ".env"-style configuration file (prior to any unset and/or set)
--unset=<NAME>
,-u <NAME>
-
remove variable from the environment
--debug
,-v
-
print verbose information for each processing step
--split-string=<S>
,-S <S>
-
process and split S into separate arguments; used to pass multiple arguments on shebang lines
--argv0=<a>
,-a <a>
-
Override the zeroth argument passed to the command being executed. Without this option a default value of
command
is used. --ignore-signal=<SIG>
-
set handling of SIG signal(s) to do nothing
A mere - implies -i. If no COMMAND, print the resulting environment.
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 {{program}}
Remove variable from the environment and run a program:
env -u {{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}}
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
expand
expand [OPTION]... [FILE]...
Convert tabs in each FILE
to spaces, writing to standard output.
With no FILE
, or when FILE
is -
, read standard input.
Options
--initial
,-i
-
do not convert tabs after non blanks
--tabs=<N, LIST>
,-t <N, LIST>
-
have tabs N characters apart, not 8 or use comma separated list of explicit tab positions
--no-utf8
,-U
-
interpret input file as 8-bit ASCII rather than UTF-8
Examples
Convert tabs in each file to spaces, writing to stdout
:
expand {{path/to/file}}
Convert tabs to spaces, reading from stdin
:
expand
Do not convert tabs after non blanks:
expand -i {{path/to/file}}
Have tabs a certain number of characters apart, not 8:
expand -t {{number}} {{path/to/file}}
Use a comma separated list of explicit tab positions:
expand -t {{1,4,6}}
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
expr
expr [EXPRESSION]
expr [OPTIONS]
Print the value of EXPRESSION
to standard output
Options
--version
-
output version information and exit
--help
-
display this help and exit
Print the value of EXPRESSION
to standard output. A blank line below
separates increasing precedence groups.
EXPRESSION
may be:
ARG1 | ARG2
:ARG1
if it is neither null nor 0, otherwiseARG2
ARG1 & ARG2
:ARG1
if neither argument is null or 0, otherwise 0ARG1 < ARG2
:ARG1
is less thanARG2
ARG1 <= ARG2
:ARG1
is less than or equal toARG2
ARG1 = ARG2
:ARG1
is equal toARG2
ARG1 != ARG2
:ARG1
is unequal toARG2
ARG1 >= ARG2
:ARG1
is greater than or equal toARG2
ARG1 > ARG2
:ARG1
is greater thanARG2
ARG1 + ARG2
: arithmetic sum ofARG1
andARG2
ARG1 - ARG2
: arithmetic difference ofARG1
andARG2
ARG1 * ARG2
: arithmetic product ofARG1
andARG2
ARG1 / ARG2
: arithmetic quotient ofARG1
divided byARG2
ARG1 % ARG2
: arithmetic remainder ofARG1
divided byARG2
STRING : REGEXP
: anchored pattern match ofREGEXP
inSTRING
match STRING REGEXP
: same asSTRING : REGEXP
substr STRING POS LENGTH
: substring ofSTRING
,POS
counted from 1index STRING CHARS
: index inSTRING
where anyCHARS
is found, or 0length STRING
: length ofSTRING
+ TOKEN
: interpretTOKEN
as a string, even if it is a keyword likematch
or an operator like/
( EXPRESSION )
: value ofEXPRESSION
Beware that many operators need to be escaped or quoted for shells. Comparisons are arithmetic if both ARGs are numbers, else lexicographical. Pattern matches return the string matched between ( and ) or null; if ( and ) are not used, they return the number of characters matched or 0.
Exit status is 0
if EXPRESSION
is neither null nor 0
, 1
if EXPRESSION
is null or 0
, 2
if EXPRESSION
is syntactically invalid, and 3
if an
error occurred.
Environment variables:
EXPR_DEBUG_TOKENS=1
: dump expression's tokensEXPR_DEBUG_RPN=1
: dump expression represented in reverse polish notationEXPR_DEBUG_SYA_STEP=1
: dump each parser stepEXPR_DEBUG_AST=1
: dump expression represented abstract syntax tree
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 the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
factor
factor [OPTION]... [NUMBER]...
Print the prime factors of the given NUMBER(s). If none are specified, read from standard input.
Options
--exponents
,-h
-
Print factors in the form p^e
--help
-
Print help information.
Examples
Display the prime-factorization of a number:
factor {{number}}
Take the input from stdin
if no argument is specified:
echo {{number}} | factor
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
false
false
Returns false, an unsuccessful exit status.
Immediately returns with the exit status 1
. When invoked with one of the recognized options it
will try to write the help or version text. Any IO error during this operation is diagnosed, yet
the program will also return 1
.
Options
--help
-
Print help information
--version
-
Print version information
Examples
Return a non-zero exit code:
false
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
fmt
fmt [-WIDTH] [OPTION]... [FILE]...
Reformat paragraphs from input files (or stdin) to stdout.
Options
--crown-margin
,-c
-
First and second line of paragraph may have different indentations, in which case the first line's indentation is preserved, and each subsequent line's indentation matches the second line.
--tagged-paragraph
,-t
-
Like -c, except that the first and second line of a paragraph must have different indentation or they are treated as separate paragraphs.
--preserve-headers
,-m
-
Attempt to detect and preserve mail headers in the input. Be careful when combining this flag with -p.
--split-only
,-s
-
Split lines only, do not reflow.
--uniform-spacing
,-u
-
Insert exactly one space between words, and two between sentences. Sentence breaks in the input are detected as [?!.] followed by two spaces or a newline; other punctuation is not interpreted as a sentence break.
--prefix=<PREFIX>
,-p <PREFIX>
-
Reformat only lines beginning with PREFIX, reattaching PREFIX to reformatted lines. Unless -x is specified, leading whitespace will be ignored when matching PREFIX.
--skip-prefix=<PSKIP>
,-P <PSKIP>
-
Do not reformat lines beginning with PSKIP. Unless -X is specified, leading whitespace will be ignored when matching PSKIP
--exact-prefix
,-x
-
PREFIX must match at the beginning of the line with no preceding whitespace.
--exact-skip-prefix
,-X
-
PSKIP must match at the beginning of the line with no preceding whitespace.
--width=<WIDTH>
,-w <WIDTH>
-
Fill output lines up to a maximum of WIDTH columns, default 75. This can be specified as a negative number in the first argument.
--goal=<GOAL>
,-g <GOAL>
-
Goal width, default of 93% of WIDTH. Must be less than or equal to WIDTH.
--quick
,-q
-
Break lines more quickly at the expense of a potentially more ragged appearance.
--tab-width=<TABWIDTH>
,-T <TABWIDTH>
-
Treat tabs as TABWIDTH spaces for determining line length, default 8. Note that this is used only for calculating line lengths; tabs are preserved in the output.
Examples
Reformat a file:
fmt {{path/to/file}}
Reformat a file producing output lines of (at most) n
characters:
fmt -w {{n}} {{path/to/file}}
Reformat a file without joining lines shorter than the given width together:
fmt -s {{path/to/file}}
Reformat a file with uniform spacing (1 space between words and 2 spaces between paragraphs):
fmt -u {{path/to/file}}
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
fold
fold [OPTION]... [FILE]...
Writes each file (or standard input if no files are given) to standard output whilst breaking long lines
Options
--bytes
,-b
-
count using bytes rather than columns (meaning control characters such as newline are not treated specially)
--spaces
,-s
-
break lines at word boundaries rather than a hard cut-off
--width=<WIDTH>
,-w <WIDTH>
-
set WIDTH as the maximum line width rather than 80
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 the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
groups
groups [OPTION]... [USERNAME]...
Print group memberships for each USERNAME
or, if no USERNAME
is specified, for
the current process (which may differ if the groups data‐base has changed).
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 the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
hashsum
hashsum [OPTIONS] [FILE]...
Compute and check message digests.
Options
--binary
,-b
-
read in binary mode
--check
,-c
-
read hashsums from the FILEs and check them
--tag
-
create a BSD-style checksum
--text
,-t
-
read in text mode (default)
--quiet
,-q
-
don't print OK for each successfully verified file
--status
,-s
-
don't output anything, status code shows success
--strict
-
exit non-zero for improperly formatted checksum lines
--ignore-missing
-
don't fail or report status for missing files
--warn
,-w
-
warn about improperly formatted checksum lines
--zero
,-z
-
end each output line with NUL, not newline
--bits=<BITS>
-
set the size of the output (only for SHAKE)
--no-names
-
Omits filenames in the output (option not present in GNU/Coreutils)
--md5
-
work with MD5
--sha1
-
work with SHA1
--sha224
-
work with SHA224
--sha256
-
work with SHA256
--sha384
-
work with SHA384
--sha512
-
work with SHA512
--sha3
-
work with SHA3
--sha3-224
-
work with SHA3-224
--sha3-256
-
work with SHA3-256
--sha3-384
-
work with SHA3-384
--sha3-512
-
work with SHA3-512
--shake128
-
work with SHAKE128 using BITS for the output size
--shake256
-
work with SHAKE256 using BITS for the output size
--b2sum
-
work with BLAKE2
--b3sum
-
work with BLAKE3
head
head [FLAG]... [FILE]...
Print the first 10 lines of each FILE
to standard output.
With more than one FILE
, precede each with a header giving the file name.
With no FILE
, or when FILE
is -
, read standard input.
Mandatory arguments to long flags are mandatory for short flags too.
Options
--bytes=<[-]NUM>
,-c <[-]NUM>
-
print the first NUM bytes of each file;
with the leading '-', print all but the last
NUM bytes of each file --lines=<[-]NUM>
,-n <[-]NUM>
-
print the first NUM lines instead of the first 10;
with the leading '-', print all but the last
NUM lines of each file --quiet
,--silent
,-q
-
never print headers giving file names
--verbose
,-v
-
always print headers giving file names
--presume-input-pipe
--zero-terminated
,-z
-
line delimiter is NUL, not newline
Examples
Output the first few lines of a file:
head -n {{count}} {{path/to/file}}
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
hostid
hostid [options]
Print the numeric identifier (in hexadecimal) for the current host
Options
Examples
Display the numeric identifier for the current host in hexadecimal:
hostid
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
hostname
hostname [OPTION]... [HOSTNAME]
Display or set the system's host name.
Options
--domain
,-d
-
Display the name of the DNS domain if possible
--ip-address
,-i
-
Display the network address(es) of the host
--fqdn
,-f
-
Display the FQDN (Fully Qualified Domain Name) (default)
--short
,-s
-
Display the short hostname (the portion before the first dot) if possible
Examples
Show current host name:
hostname
Show the network address of the host name:
hostname -i
Show all network addresses of the host:
hostname -I
Show the FQDN (Fully Qualified Domain Name):
hostname --fqdn
Set current host name:
hostname {{new_hostname}}
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
id
id [OPTION]... [USER]...
Print user and group information for each specified USER
,
or (when USER
omitted) for the current user.
Options
-A
-
Display the process audit user ID and other process audit properties,
which requires privilege (not available on Linux). --user
,-u
-
Display only the effective user ID as a number.
--group
,-g
-
Display only the effective group ID as a number
--groups
,-G
-
Display only the different group IDs as white-space separated numbers, in no particular order.
-p
-
Make the output human-readable. Each display is on a separate line.
--name
,-n
-
Display the name of the user or group ID for the -G, -g and -u options instead of the number.
If any of the ID numbers cannot be mapped into names, the number will be displayed as usual. -P
-
Display the id as a password file entry.
--real
,-r
-
Display the real ID for the -G, -g and -u options instead of the effective ID.
--zero
,-z
-
delimit entries with NUL characters, not whitespace;
not permitted in default format --context
,-Z
-
print only the security context of the process
The id utility displays the user and group names and numeric IDs, of the calling process, to the standard output. If the real and effective IDs are different, both are displayed, otherwise only the real ID is displayed.
If a user (login name or user ID) is specified, the user and group IDs of that user are displayed. In this case, the real and effective IDs are assumed to be the same.
Examples
Display current user's ID (UID), group ID (GID) and groups to which they belong:
id
Display the current user identity:
id -un
Display the current user identity as a number:
id -u
Display the current primary group identity:
id -gn
Display the current primary group identity as a number:
id -g
Display an arbitrary user's ID (UID), group ID (GID) and groups to which they belong:
id {{username}}
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
install
install [OPTION]... [FILE]...
Copy SOURCE to DEST or multiple SOURCE(s) to the existing DIRECTORY, while setting permission modes and owner/group
Options
--backup=<CONTROL>
-
make a backup of each existing destination file
-b
-
like --backup but does not accept an argument
-c
-
ignored
--compare
,-C
-
compare each pair of source and destination files, and in some cases, do not modify the destination at all
--directory
,-d
-
treat all arguments as directory names. create all components of the specified directories
-D
-
create all leading components of DEST except the last, then copy SOURCE to DEST
--group=<GROUP>
,-g <GROUP>
-
set group ownership, instead of process's current group
--mode=<MODE>
,-m <MODE>
-
set permission mode (as in chmod), instead of rwxr-xr-x
--owner=<OWNER>
,-o <OWNER>
-
set ownership (super-user only)
--preserve-timestamps
,-p
-
apply access/modification times of SOURCE files to corresponding destination files
--strip
,-s
-
strip symbol tables (no action Windows)
--strip-program=<PROGRAM>
-
program used to strip binaries (no action Windows)
--suffix=<SUFFIX>
,-S <SUFFIX>
-
override the usual backup suffix
--target-directory=<DIRECTORY>
,-t <DIRECTORY>
-
move all SOURCE arguments into DIRECTORY
--no-target-directory
,-T
-
(unimplemented) treat DEST as a normal file
--verbose
,-v
-
explain what is being done
--preserve-context
,-P
-
(unimplemented) preserve security context
--context=<CONTEXT>
,-Z <CONTEXT>
-
(unimplemented) set security context of files and directories
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 --owner {{user}} {{path/to/source_file1 path/to/source_file2 ...}} {{path/to/destination}}
Copy files to the destination, setting their group ownership:
install --group {{user}} {{path/to/source_file1 path/to/source_file2 ...}} {{path/to/destination}}
Copy files to the destination, setting their mode
:
install --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 --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 the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
join
join [OPTION]... FILE1 FILE2
For each pair of input lines with identical join fields, write a line to standard output. The default join field is the first, delimited by blanks.
When FILE1
or FILE2
(not both) is -
, read standard input.
Options
-a <FILENUM>
-
also print unpairable lines from file FILENUM, where
FILENUM is 1 or 2, corresponding to FILE1 or FILE2 -v <FILENUM>
-
like -a FILENUM, but suppress joined output lines
-e <EMPTY>
-
replace missing input fields with EMPTY
--ignore-case
,-i
-
ignore differences in case when comparing fields
-j <FIELD>
-
equivalent to '-1 FIELD -2 FIELD'
-o <FORMAT>
-
obey FORMAT while constructing output line
-t <CHAR>
-
use CHAR as input and output field separator
-1 <FIELD>
-
join on this FIELD of file 1
-2 <FIELD>
-
join on this FIELD of file 2
--check-order
-
check that the input is correctly sorted, even if all input lines are pairable
--nocheck-order
-
do not check that the input is correctly sorted
--header
-
treat the first line in each file as field headers, print them without trying to pair them
--zero-terminated
,-z
-
line delimiter is NUL, not newline
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 from stdin
:
cat {{path/to/file1}} | join - {{path/to/file2}}
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
kill
kill [OPTIONS]... PID...
Send signal to processes or list information about signals.
Options
--list
,-l
-
Lists signals
--table
,-t
-
Lists table of signals
--signal=<signal>
,-s <signal>
-
Sends given signal instead of SIGTERM
Examples
Terminate a program using the default SIGTERM (terminate) signal:
kill {{process_id}}
List available signal names (to be used without the SIG
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 a SIGUSR1
signal to all processes with the given GID (group id):
kill -{{SIGUSR1}} -{{group_id}}
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
link
link FILE1 FILE2
Call the link function to create a link named FILE2 to an existing FILE1.
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 the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
ln
ln [OPTION]... [-T] TARGET LINK_NAME
ln [OPTION]... TARGET
ln [OPTION]... TARGET... DIRECTORY
ln [OPTION]... -t DIRECTORY TARGET...
Make links between files.
Options
--backup=<CONTROL>
-
make a backup of each existing destination file
-b
-
like --backup but does not accept an argument
--force
,-f
-
remove existing destination files
--interactive
,-i
-
prompt whether to remove existing destination files
--no-dereference
,-n
-
treat LINK_NAME as a normal file if it is a symbolic link to a directory
--logical
,-L
-
follow TARGETs that are symbolic links
--physical
,-P
-
make hard links directly to symbolic links
--symbolic
,-s
-
make symbolic links instead of hard links
--suffix=<SUFFIX>
,-S <SUFFIX>
-
override the usual backup suffix
--target-directory=<DIRECTORY>
,-t <DIRECTORY>
-
specify the DIRECTORY in which to create the links
--no-target-directory
,-T
-
treat LINK_NAME as a normal file always
--relative
,-r
-
create symbolic links relative to link location
--verbose
,-v
-
print name of each linked file
In the 1st form, create a link to TARGET with the name LINK_NAME. In the 2nd form, create a link to TARGET in the current directory. In the 3rd and 4th forms, create links to each TARGET in DIRECTORY. Create hard links by default, symbolic links with --symbolic. By default, each destination (name of new link) should not already exist. When creating hard links, each TARGET must exist. Symbolic links can hold arbitrary text; if later resolved, a relative link is interpreted in relation to its parent directory.
Examples
Create a symbolic link to a file or directory:
ln -s {{/path/to/file_or_directory}} {{path/to/symlink}}
Overwrite an existing symbolic link to point to a different file:
ln -sf {{/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 the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
logname
logname
Print user's login name
Options
Examples
Display the currently logged in user's name:
logname
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
ls
ls [OPTION]... [FILE]...
List directory contents. Ignore files and directories starting with a '.' by default
Options
--help
-
Print help information.
--format
-
Set the display format.
-C
-
Display the files in columns.
--long
,-l
-
Display detailed information.
-x
-
List entries in rows instead of in columns.
--tabsize=<COLS>
,-T <COLS>
-
Assume tab stops at each COLS instead of 8 (unimplemented)
-m
-
List entries separated by commas.
--zero
-
List entries separated by ASCII NUL characters.
--dired
,-D
-
generate output designed for Emacs' dired (Directory Editor) mode
--hyperlink=<WHEN>
-
hyperlink file names WHEN
-1
-
List one file per line.
-o
-
Long format without group information. Identical to --format=long with --no-group.
-g
-
Long format without owner information.
--numeric-uid-gid
,-n
-
-l with numeric UIDs and GIDs.
--quoting-style
-
Set quoting style.
--literal
,-N
-
Use literal quoting style. Equivalent to
--quoting-style=literal
--escape
,-b
-
Use escape quoting style. Equivalent to
--quoting-style=escape
--quote-name
,-Q
-
Use C quoting style. Equivalent to
--quoting-style=c
--hide-control-chars
,-q
-
Replace control characters with '?' if they are not escaped.
--show-control-chars
-
Show control characters 'as is' if they are not escaped.
--time=<field>
-
Show time in
:
access time (-u): atime, access, use;
change time (-t): ctime, status.
birth time: birth, creation; -c
-
If the long listing format (e.g., -l, -o) is being used, print the status change time (the 'ctime' in the inode) instead of the modification time. When explicitly sorting by time (--sort=time or -t) or when not using a long listing format, sort according to the status change time.
-u
-
If the long listing format (e.g., -l, -o) is being used, print the status access time instead of the modification time. When explicitly sorting by time (--sort=time or -t) or when not using a long listing format, sort according to the access time.
--hide=<PATTERN>
-
do not list implied entries matching shell PATTERN (overridden by -a or -A)
--ignore=<PATTERN>
,-I <PATTERN>
-
do not list implied entries matching shell PATTERN
--ignore-backups
,-B
-
Ignore entries which end with ~.
--sort=<field>
-
Sort by
: name, none (-U), time (-t), size (-S), extension (-X) or width -S
-
Sort by file size, largest first.
-t
-
Sort by modification time (the 'mtime' in the inode), newest first.
-v
-
Natural sort of (version) numbers in the filenames.
-X
-
Sort alphabetically by entry extension.
-U
-
Do not sort; list the files in whatever order they are stored in the directory. This is especially useful when listing very large directories, since not doing any sorting can be noticeably faster.
--dereference
,-L
-
When showing file information for a symbolic link, show information for the file the link references rather than the link itself.
--dereference-command-line-symlink-to-dir
-
Do not follow symlinks except when they link to directories and are given as command line arguments.
--dereference-command-line
,-H
-
Do not follow symlinks except when given as command line arguments.
--no-group
,-G
-
Do not show group in long format.
--author
-
Show author in long format. On the supported platforms, the author always matches the file owner.
--all
,-a
-
Do not ignore hidden files (files with names that start with '.').
--almost-all
,-A
-
In a directory, do not ignore all file names that start with '.', only ignore '.' and '..'.
--directory
,-d
-
Only list the names of directories, rather than listing directory contents. This will not follow symbolic links unless one of
--dereference-command-line (-H)
,--dereference (-L)
, or--dereference-command-line-symlink-to-dir
is specified. --human-readable
,-h
-
Print human readable file sizes (e.g. 1K 234M 56G).
--kibibytes
,-k
-
default to 1024-byte blocks for file system usage; used only with -s and per directory totals
--si
-
Print human readable file sizes using powers of 1000 instead of 1024.
--block-size=<BLOCK_SIZE>
-
scale sizes by BLOCK_SIZE when printing them
--inode
,-i
-
print the index number of each file
--reverse
,-r
-
Reverse whatever the sorting method is e.g., list files in reverse alphabetical order, youngest first, smallest first, or whatever.
--recursive
,-R
-
List the contents of all directories recursively.
--width=<COLS>
,-w <COLS>
-
Assume that the terminal is COLS columns wide.
--size
,-s
-
print the allocated size of each file, in blocks
--color
-
Color output based on file type.
--indicator-style
-
Append indicator with style WORD to entry names: none (default), slash (-p), file-type (--file-type), classify (-F)
--classify=<when>
,-F <when>
-
Append a character to each file name indicating the file type. Also, for regular files that are executable, append '*'. The file type indicators are '/' for directories, '@' for symbolic links, '|' for FIFOs, '=' for sockets, '>' for doors, and nothing for regular files. when may be omitted, or one of:
none - Do not classify. This is the default.
auto - Only classify if standard output is a terminal.
always - Always classify.
Specifying --classify and no when is equivalent to --classify=always. This will not follow symbolic links listed on the command line unless the --dereference-command-line (-H), --dereference (-L), or --dereference-command-line-symlink-to-dir options are specified. --file-type
-
Same as --classify, but do not append '*'
-p
-
Append / indicator to directories.
--time-style=<TIME_STYLE>
-
time/date format with -l; see TIME_STYLE below
--full-time
-
like -l --time-style=full-iso
--context
,-Z
-
print any security context of each file
--group-directories-first
-
group directories before files; can be augmented with a --sort option, but any use of --sort=none (-U) disables grouping
The TIME_STYLE argument can be full-iso, long-iso, iso, locale or +FORMAT. FORMAT is interpreted like in date. Also the TIME_STYLE environment variable sets the default style to use.
Examples
List files one per line:
ls -1
List [a]ll files, including hidden files:
ls -a
List files with a trailing symbol to indicate file type (directory/, symbolic_link@, executable*, ...):
ls -F
List [a]ll files in [l]ong format (permissions, ownership, size, and modification date):
ls -la
List files in [l]ong format with size displayed using [h]uman-readable units (KiB, MiB, GiB):
ls -lh
List files in [l]ong format, sorted by [S]ize (descending) [R]ecursively:
ls -lSR
List files in [l]ong format, sorted by [t]ime the file was modified and in [r]everse order (oldest first):
ls -ltr
Only list [d]irectories:
ls -d */
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
md5sum
Options
--binary
,-b
-
read in binary mode
--check
,-c
-
read hashsums from the FILEs and check them
--tag
-
create a BSD-style checksum
--text
,-t
-
read in text mode (default)
--quiet
,-q
-
don't print OK for each successfully verified file
--status
,-s
-
don't output anything, status code shows success
--strict
-
exit non-zero for improperly formatted checksum lines
--ignore-missing
-
don't fail or report status for missing files
--warn
,-w
-
warn about improperly formatted checksum lines
--zero
,-z
-
end each output line with NUL, not newline
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 from stdin
:
{{command}} | md5sum
Read a file of MD5 sums and filenames and verify all files have matching checksums:
md5sum --check {{path/to/file.md5}}
Only show a message for missing files or when verification fails:
md5sum --check --quiet {{path/to/file.md5}}
Only show a message when verification fails, ignoring missing files:
md5sum --ignore-missing --check --quiet {{path/to/file.md5}}
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
mkdir
mkdir [OPTION]... DIRECTORY...
Create the given DIRECTORY(ies) if they do not exist
Options
--mode
,-m
-
set file mode (not implemented on windows)
--parents
,-p
-
make parent directories as needed
--verbose
,-v
-
print a message for each printed directory
Each MODE is of the form '[ugoa]*(-+=)+|[-+=]?[0-7]+'.
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 ...}}
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
mkfifo
mkfifo [OPTION]... NAME...
Create a FIFO with the given name.
Options
--mode=<MODE>
,-m <MODE>
-
file permissions for the fifo
-Z
-
set the SELinux security context to default type
--context=<CTX>
-
like -Z, or if CTX is specified then set the SELinux or SMACK security context to CTX
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 {{path/to/pipe}}
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
mknod
mknod [OPTION]... NAME TYPE [MAJOR MINOR]
Create the special file NAME of the given TYPE.
Options
--mode=<MODE>
,-m <MODE>
-
set file permission bits to MODE, not a=rw - umask
-
name of the new file
-
type of the new file (b, c, u or p)
-
major file type
-
minor file type
Mandatory arguments to long options are mandatory for short options too.
-m
, --mode=MODE
set file permission bits to MODE
, not a=rw - umask
Both MAJOR
and MINOR
must be specified when TYPE
is b
, c
, or u
, and they
must be omitted when TYPE
is p
. If MAJOR
or MINOR
begins with 0x
or 0X
,
it is interpreted as hexadecimal; otherwise, if it begins with 0, as octal;
otherwise, as decimal. TYPE
may be:
b
create a block (buffered) special filec
,u
create a character (unbuffered) special filep
create a FIFO
NOTE: your shell may have its own version of mknod, which usually supersedes the version described here. Please refer to your shell's documentation for details about the options it supports.
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 {{path/to/device_file}} {{type}} {{major_device_number}} {{minor_device_number}}
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
mktemp
mktemp [OPTION]... [TEMPLATE]
Create a temporary file or directory.
Options
--directory
,-d
-
Make a directory instead of a file
--dry-run
,-u
-
do not create anything; merely print a name (unsafe)
--quiet
,-q
-
Fail silently if an error occurs.
--suffix=<SUFFIX>
-
append SUFFIX to TEMPLATE; SUFFIX must not contain a path separator. This option is implied if TEMPLATE does not end with X.
-p <DIR>
-
short form of --tmpdir
--tmpdir=<DIR>
-
interpret TEMPLATE relative to DIR; if DIR is not specified, use $TMPDIR ($TMP on windows) if set, else /tmp. With this option, TEMPLATE must not be an absolute name; unlike with -t, TEMPLATE may contain slashes, but mktemp creates only the final component
-t
-
Generate a template (using the supplied prefix and TMPDIR (TMP on windows) if set) to create a filename template [deprecated]
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 the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
more
more [OPTIONS] FILE...
Display the contents of a text file
Options
--print-over
,-c
-
Do not scroll, display text and clean line ends
--silent
,-d
-
Display help instead of ringing bell
--clean-print
,-p
-
Do not scroll, clean screen and display text
--squeeze
,-s
-
Squeeze multiple blank lines into one
--plain
,-u
--pattern=<pattern>
,-P <pattern>
-
Display file beginning from pattern match
--from-line=<number>
,-F <number>
-
Display file beginning from line number
--lines=<number>
,-n <number>
-
The number of lines per screen full
--number
-
Same as --lines
-
Path to the files to be read
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}}
Exit:
q
Display help about interactive commands:
h
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
mv
mv [OPTION]... [-T] SOURCE DEST
mv [OPTION]... SOURCE... DIRECTORY
mv [OPTION]... -t DIRECTORY SOURCE...
Move SOURCE
to DEST
, or multiple SOURCE
(s) to DIRECTORY
.
Options
--force
,-f
-
do not prompt before overwriting
--interactive
,-i
-
prompt before override
--no-clobber
,-n
-
do not overwrite an existing file
--strip-trailing-slashes
-
remove any trailing slashes from each SOURCE argument
--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>
-
move all SOURCE arguments into DIRECTORY
--no-target-directory
,-T
-
treat DEST as a normal file
--verbose
,-v
-
explain what is being done
--progress
,-g
-
Display a progress bar.
Note: this feature is not supported by GNU coreutils. --debug
-
explain how a file is copied. Implies -v
When specifying more than one of -i, -f, -n, only the final one will take effect.
Do not move a non-directory that has an existing destination with the same or newer modification timestamp;
instead, silently skip the file without failing. If the move is across file system boundaries, the comparison is
to the source timestamp truncated to the resolutions of the destination file system and of the system calls used
to update timestamps; this avoids duplicate work if several mv -u
commands are executed with the same source
and destination. This option is ignored if the -n
or --no-clobber
option is also specified. which gives more control
over which existing files in the destination are replaced, and its value can be one of the following:
all
This is the default operation when an--update
option is not specified, and results in all existing files in the destination being replaced.none
This is similar to the--no-clobber
option, in that no files in the destination are replaced, but also skipping a file does not induce a failure.older
This is the default operation when--update
is specified, and results in files being replaced if they’re older than the corresponding source file.
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 ([f]) for confirmation before overwriting existing files:
mv --force {{path/to/source}} {{path/to/target}}
Prompt for confirmation [i]nteractively before overwriting existing files, regardless of file permissions:
mv --interactive {{path/to/source}} {{path/to/target}}
Do not overwrite ([n]) existing files at the target:
mv --no-clobber {{path/to/source}} {{path/to/target}}
Move files in [v]erbose mode, showing files after they are moved:
mv --verbose {{path/to/source}} {{path/to/target}}
Specify [t]arget directory so that you can use external tools to gather movable files:
{{find /var/log -type f -name '*.log' -print0}} | {{xargs -0}} mv --target-directory {{path/to/target_directory}}
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
nice
nice [OPTIONS] [COMMAND [ARGS]]
Run COMMAND
with an adjusted niceness, which affects process scheduling.
With no COMMAND
, print the current niceness. Niceness values range from at
least -20 (most favorable to the process) to 19 (least favorable to the
process).
Options
--adjustment
,-n
-
add N to the niceness (default is 10)
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 the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
nl
nl [OPTION]... [FILE]...
Number lines of files
Options
--help
-
Print help information.
--body-numbering=<STYLE>
,-b <STYLE>
-
use STYLE for numbering body lines
--section-delimiter=<CC>
,-d <CC>
-
use CC for separating logical pages
--footer-numbering=<STYLE>
,-f <STYLE>
-
use STYLE for numbering footer lines
--header-numbering=<STYLE>
,-h <STYLE>
-
use STYLE for numbering header lines
--line-increment=<NUMBER>
,-i <NUMBER>
-
line number increment at each line
--join-blank-lines=<NUMBER>
,-l <NUMBER>
-
group of NUMBER empty lines counted as one
--number-format=<FORMAT>
,-n <FORMAT>
-
insert line numbers according to FORMAT
--no-renumber
,-p
-
do not reset line numbers at logical pages
--number-separator=<STRING>
,-s <STRING>
-
add STRING after (possible) line number
--starting-line-number=<NUMBER>
,-v <NUMBER>
-
first line number on each logical page
--number-width=<NUMBER>
,-w <NUMBER>
-
use NUMBER columns for line numbers
STYLE
is one of:
a
number all linest
number only nonempty linesn
number no linespBRE
number only lines that contain a match for the basic regular expression,BRE
FORMAT
is one of:
ln
left justified, no leading zerosrn
right justified, no leading zerosrz
right justified, leading zeros
Examples
Number non-blank lines in a file:
nl {{path/to/file}}
Read from stdin
:
{{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 the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
nohup
nohup COMMAND [ARG]...
nohup OPTION
Run COMMAND ignoring hangup signals.
Options
If standard input is terminal, it'll be replaced with /dev/null. If standard output is terminal, it'll be appended to nohup.out instead, or $HOME/nohup.out, if nohup.out open failed. If standard error is terminal, it'll be redirected to stdout.
Examples
Run a process that can live beyond the terminal:
nohup {{command}} {{argument1 argument2 ...}}
Launch nohup
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 the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
nproc
nproc [OPTIONS]...
Print the number of cores available to the current process.
If the OMP_NUM_THREADS
or OMP_THREAD_LIMIT
environment variables are set, then
they will determine the minimum and maximum returned value respectively.
Options
--all
-
print the number of cores available to the system
--ignore=<N>
-
ignore up to N cores
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 the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
numfmt
numfmt [OPTION]... [NUMBER]...
Convert numbers from/to human-readable strings
Options
--delimiter=<X>
,-d <X>
-
use X instead of whitespace for field delimiter
--field=<FIELDS>
-
replace the numbers in these input fields; see FIELDS below
--format=<FORMAT>
-
use printf style floating-point FORMAT; see FORMAT below for details
--from=<UNIT>
-
auto-scale input numbers to UNITs; see UNIT below
--from-unit=<N>
-
specify the input unit size
--to=<UNIT>
-
auto-scale output numbers to UNITs; see UNIT below
--to-unit=<N>
-
the output unit size
--padding=<N>
-
pad the output to N characters; positive N will right-align; negative N will left-align; padding is ignored if the output is wider than N; the default is to automatically pad if a whitespace is found
--header=<N>
-
print (without converting) the first N header lines; N defaults to 1 if not specified
--round=<METHOD>
-
use METHOD for rounding when scaling
--suffix=<SUFFIX>
-
print SUFFIX after each formatted number, and accept inputs optionally ending with SUFFIX
--invalid=<INVALID>
-
set the failure mode for invalid input
UNIT
options:
-
none
: no auto-scaling is done; suffixes will trigger an error -
auto
: accept optional single/two letter suffix:1K = 1000, 1Ki = 1024, 1M = 1000000, 1Mi = 1048576,
-
si
: accept optional single letter suffix:1K = 1000, 1M = 1000000, ...
-
iec
: accept optional single letter suffix:1K = 1024, 1M = 1048576, ...
-
iec-i
: accept optional two-letter suffix:1Ki = 1024, 1Mi = 1048576, ...
-
FIELDS
supportscut(1)
style field ranges:N N'th field, counted from 1 N- from N'th field, to end of line N-M from N'th to M'th field (inclusive) -M from first to M'th field (inclusive)
- all fields
Multiple fields/ranges can be separated with commas
FORMAT
must be suitable for printing one floating-point argument %f
.
Optional quote (%'f
) will enable --grouping (if supported by current locale).
Optional width value (%10f
) will pad output. Optional zero (%010f
) width
will zero pad the number. Optional negative values (%-10f
) will left align.
Optional precision (%.1f
) will override the input determined precision.
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 * | numfmt --to=iec --format="%-5f"
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
od
od [OPTION]... [--] [FILENAME]...
od [-abcdDefFhHiIlLoOsxX] [FILENAME] [[+][0x]OFFSET[.][b]]
od --traditional [OPTION]... [FILENAME] [[+][0x]OFFSET[.][b] [[+][0x]LABEL[.][b]]]
Dump files in octal and other formats
Options
--help
-
Print help information.
--address-radix=<RADIX>
,-A <RADIX>
-
Select the base in which file offsets are printed.
--skip-bytes=<BYTES>
,-j <BYTES>
-
Skip bytes input bytes before formatting and writing.
--read-bytes=<BYTES>
,-N <BYTES>
-
limit dump to BYTES input bytes
--endian=<big|little>
-
byte order to use for multi-byte formats
--strings=<BYTES>
,-S <BYTES>
-
NotImplemented: output strings of at least BYTES graphic chars. 3 is assumed when BYTES is not specified.
-a
-
named characters, ignoring high-order bit
-b
-
octal bytes
-c
-
ASCII characters or backslash escapes
-d
-
unsigned decimal 2-byte units
-D
-
unsigned decimal 4-byte units
-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>
-
select output format or formats
--output-duplicates
,-v
-
do not use * to mark line suppression
--width=<BYTES>
,-w <BYTES>
-
output BYTES bytes per output line. 32 is implied when BYTES is not specified.
--traditional
-
compatibility mode with one input, offset and label.
Displays data in various human-readable formats. If multiple formats are specified, the output will contain all formats in the order they appear on the command line. Each format will be printed on a new line. Only the line containing the first format will be prefixed with the offset.
If no filename is specified, or it is "-", stdin will be used. After a "--", no more options will be recognized. This allows for filenames starting with a "-".
If a filename is a valid number which can be used as an offset in the second form, you can force it to be recognized as a filename if you include an option like "-j0", which is only valid in the first form.
RADIX is one of o,d,x,n for octal, decimal, hexadecimal or none.
BYTES is decimal by default, octal if prefixed with a "0", or hexadecimal if prefixed with "0x". The suffixes b, KB, K, MB, M, GB, G, will multiply the number with 512, 1000, 1024, 1000^2, 1024^2, 1000^3, 1024^3, 1000^2, 1024^2.
OFFSET and LABEL are octal by default, hexadecimal if prefixed with "0x" or decimal if a "." suffix is added. The "b" suffix will multiply with 512.
TYPE contains one or more format specifications consisting of: a for printable 7-bits ASCII c for utf-8 characters or octal for undefined characters d[SIZE] for signed decimal f[SIZE] for floating point o[SIZE] for octal u[SIZE] for unsigned decimal x[SIZE] for hexadecimal SIZE is the number of bytes which can be the number 1, 2, 4, 8 or 16, or C, I, S, L for 1, 2, 4, 8 bytes for integer types, or F, D, L for 4, 8, 16 bytes for floating point. Any type specification can have a "z" suffix, which will add a ASCII dump at the end of the line.
If an error occurred, a diagnostic message will be printed to stderr, and the exit code will be non-zero.
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 {{path/to/file}}
Display file in hexadecimal format (2-byte units), with byte offsets in decimal format:
od --format={{x}} --address-radix={{d}} -v {{path/to/file}}
Display file in hexadecimal format (1-byte units), and 4 bytes per line:
od --format={{x1}} --width={{4}} -v {{path/to/file}}
Display file in hexadecimal format along with its character representation, and do not print byte offsets:
od --format={{xz}} --address-radix={{n}} -v {{path/to/file}}
Read only 100 bytes of a file starting from the 500th byte:
od --read-bytes 100 --skip-bytes=500 -v {{path/to/file}}
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
paste
paste [OPTIONS] [FILE]...
Write lines consisting of the sequentially corresponding lines from each
FILE
, separated by TAB
s, to standard output.
Options
--serial
,-s
-
paste one file at a time instead of in parallel
--delimiters=<LIST>
,-d <LIST>
-
reuse characters from LIST instead of TABs
--zero-terminated
,-z
-
line delimiter is NUL, not newline
Examples
Join all the lines into a single line, using TAB as delimiter:
paste -s {{path/to/file}}
Join all the lines into a single line, using the specified delimiter:
paste -s -d {{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 {{delimiter}} {{path/to/file1}} {{path/to/file2}}
Merge two files, with lines added alternatively:
paste -d '\n' {{path/to/file1}} {{path/to/file2}}
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
pathchk
pathchk [OPTION]... NAME...
Check whether file names are valid or portable
Options
-p
-
check for most POSIX systems
-P
-
check for empty names and leading "-"
--portability
-
check for all POSIX systems (equivalent to -p -P)
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 --portability {{path1 path2 …}}
Only check for empty pathnames or leading dashes (-):
pathchk -P {{path1 path2 …}}
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
pinky
pinky [OPTION]... [USER]...
Displays brief user information on Unix-based systems
Options
-l
-
produce long format output for the specified USERs
-b
-
omit the user's home directory and shell in long format
-h
-
omit the user's project file in long format
-p
-
omit the user's plan file in long format
-s
-
do short format output, this is the default
-f
-
omit the line of column headings in short format
-w
-
omit the user's full name in short format
-i
-
omit the user's full name and remote host in short format
-q
-
omit the user's full name, remote host and idle time in short format
--help
-
Print help information
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 the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
pr
pr [OPTION]... [FILE]...
Write content of given file or standard input to standard output with pagination filter
Options
--pages=<FIRST_PAGE[:LAST_PAGE]>
-
Begin and stop printing with page FIRST_PAGE[:LAST_PAGE]
--header=<STRING>
,-h <STRING>
-
Use the string header to replace the file name in the header line.
--double-space
,-d
-
Produce output that is double spaced. An extra
character is output following every found in the input. --number-lines=<[char][width]>
,-n <[char][width]>
-
Provide width digit line numbering. The default for width, if not specified, is 5. The number occupies the first width column positions of each text column or each line of -m output. If char (any non-digit character) is given, it is appended to the line number to separate it from whatever follows. The default for char is a
. Line numbers longer than width columns are truncated. --first-line-number=<NUMBER>
,-N <NUMBER>
-
start counting with NUMBER at 1st line of first page printed
--omit-header
,-t
-
Write neither the five-line identifying header nor the five-line trailer usually supplied for each page. Quit writing after the last line of each file without spacing to the end of the page.
--length=<PAGE_LENGTH>
,-l <PAGE_LENGTH>
-
Override the 66-line default (default number of lines of text 56, and with -F 63) and reset the page length to lines. If lines is not greater than the sum of both the header and trailer depths (in lines), the pr utility shall suppress both the header and trailer, as if the -t option were in effect.
--no-file-warnings
,-r
-
omit warning when a file cannot be opened
--form-feed
,-F
-
Use a
for new pages, instead of the default behavior that uses a sequence of s. --width=<width>
,-w <width>
-
Set the width of the line to width column positions for multiple text-column output only. If the -w option is not specified and the -s option is not specified, the default width shall be 72. If the -w option is not specified and the -s option is specified, the default width shall be 512.
--page-width=<width>
,-W <width>
-
set page width to PAGE_WIDTH (72) characters always, truncate lines, except -J option is set, no interference with -S or -s
--across
,-a
-
Modify the effect of the - column option so that the columns are filled across the page in a round-robin order (for example, when column is 2, the first input line heads column 1, the second heads column 2, the third is the second line in column 1, and so on).
--column=<column>
-
Produce multi-column output that is arranged in column columns (the default shall be 1) and is written down each column in the order in which the text is received from the input file. This option should not be used with -m. The options -e and -i shall be assumed for multiple text-column output. Whether or not text columns are produced with identical vertical lengths is unspecified, but a text column shall never exceed the length of the page (see the -l option). When used with -t, use the minimum number of lines to write the output.
--separator=<char>
,-s <char>
-
Separate text columns by the single character char instead of by the appropriate number of
s (default for char is the character). --sep-string=<string>
,-S <string>
-
separate columns by STRING, without -S: Default separator
with -J and otherwise (same as -S" "), no effect on column options --merge
,-m
-
Merge files. Standard output shall be formatted so the pr utility writes one line from each file specified by a file operand, side by side into text columns of equal fixed widths, in terms of the number of column positions. Implementations shall support merging of at least nine file operands.
--indent=<margin>
,-o <margin>
-
Each line of output shall be preceded by offset
s. If the -o option is not specified, the default offset shall be zero. The space taken is in addition to the output line width (see the -w option below). -J
-
merge full lines, turns off -W line truncation, no column alignment, --sep-string[=STRING] sets separators
--help
-
Print help information
+PAGE
Begin output at page number page of the formatted input.
-COLUMN
Produce multi-column output. See --column
The pr utility is a printing and pagination filter for text files. When multiple input files are specified, each is read, formatted, and written to standard output. By default, the input is separated into 66-line pages, each with
- A 5-line header with the page number, date, time, and the pathname of the file.
- A 5-line trailer consisting of blank lines.
If standard output is associated with a terminal, diagnostic messages are suppressed until the pr utility has completed processing.
When multiple column output is specified, text columns are of equal width.
By default, text columns are separated by at least one <blank>
.
Input lines that do not fit into a text column are truncated.
Lines are not truncated under single column output.
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}}" {{path/to/file1 path/to/file2 ...}}
Print with numbered lines and a custom date format:
pr -n -D "{{format}}" {{path/to/file1 path/to/file2 ...}}
Print all files together, one in each column, without a header or footer:
pr -m -T {{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 {{page_length}} {{path/to/file1 path/to/file2 ...}}
Print with an offset for each line and a truncating custom page width:
pr -o {{offset}} -W {{width}} {{path/to/file1 path/to/file2 ...}}
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
printenv
printenv [OPTION]... [VARIABLE]...
Display the values of the specified environment VARIABLE(s), or (with no VARIABLE) display name and value pairs for them all.
Options
--null
,-0
-
end each output line with 0 byte rather than newline
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 --null {{HOME}}
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
printf
printf FORMAT [ARGUMENT]...
printf OPTION
Print output based off of the format string and proceeding arguments.
Options
--help
-
Print help information
--version
-
Print version information
basic anonymous string templating:
prints format string at least once, repeating as long as there are remaining arguments output prints escaped literals in the format string as character literals output replaces anonymous fields with the next unused argument, formatted according to the field.
Prints the ,
replacing escaped character sequences with character literals
and substitution field sequences with passed arguments
literally, with the exception of the below escaped character sequences, and the substitution sequences described further down.
ESCAPE SEQUENCES
The following escape sequences, organized here in alphabetical order, will print the corresponding character literal:
-
\"
double quote -
\\\\
backslash -
\\a
alert (BEL) -
\\b
backspace -
\\c
End-of-Input -
\\e
escape -
\\f
form feed -
\\n
new line -
\\r
carriage return -
\\t
horizontal tab -
\\v
vertical tab -
\\NNN
byte with value expressed in octal value NNN (1 to 3 digits) values greater than 256 will be treated -
\\xHH
byte with value expressed in hexadecimal value NN (1 to 2 digits) -
\\uHHHH
Unicode (IEC 10646) character with value expressed in hexadecimal value HHHH (4 digits) -
\\uHHHH
Unicode character with value expressed in hexadecimal value HHHH (8 digits) -
%%
a single %
SUBSTITUTIONS
SUBSTITUTION QUICK REFERENCE
Fields
-
%s
: string -
%b
: string parsed for literals second parameter is max length -
%c
: char no second parameter -
%i
or%d
: 64-bit integer -
%u
: 64 bit unsigned integer -
%x
or%X
: 64-bit unsigned integer as hex -
%o
: 64-bit unsigned integer as octal second parameter is min-width, integer output below that width is padded with leading zeroes -
%q
: ARGUMENT is printed in a format that can be reused as shell input, escaping non-printable characters with the proposed POSIX $'' syntax. -
%f
or%F
: decimal floating point value -
%e
or%E
: scientific notation floating point value -
%g
or%G
: shorter of specially interpreted decimal or SciNote floating point value. second parameter is-max
places after decimal point for floating point output-max
number of significant digits for scientific notation output
parameterizing fields
examples:
printf '%4.3i' 7
It has a first parameter of 4 and a second parameter of 3 and will result in ' 007'
printf '%.1s' abcde
It has no first parameter and a second parameter of 1 and will result in 'a'
printf '%4c' q
It has a first parameter of 4 and no second parameter and will result in ' q'
The first parameter of a field is the minimum width to pad the output to if the output is less than this absolute value of this width, it will be padded with leading spaces, or, if the argument is negative, with trailing spaces. the default is zero.
The second parameter of a field is particular to the output field type. defaults can be found in the full substitution help below
special prefixes to numeric arguments
0
: (e.g. 010) interpret argument as octal (integer output fields only)0x
: (e.g. 0xABC) interpret argument as hex (numeric output fields only)\'
: (e.g. 'a) interpret argument as a character constant
HOW TO USE SUBSTITUTIONS
Substitutions are used to pass additional argument(s) into the FORMAT string, to be formatted a particular way. E.g.
printf 'the letter %X comes before the letter %X' 10 11
will print
the letter A comes before the letter B
because the substitution field %X
means
'take an integer argument and write it as a hexadecimal number'
Passing more arguments than are in the format string will cause the format string to be repeated for the remaining substitutions
printf 'it is %i F in %s \n' 22 Portland 25 Boston 27 New York
will print
it is 22 F in Portland
it is 25 F in Boston
it is 27 F in Boston
If a format string is printed but there are less arguments remaining than there are substitution fields, substitution fields without an argument will default to empty strings, or for numeric fields the value 0
AVAILABLE SUBSTITUTIONS
This program, like GNU coreutils printf, interprets a modified subset of the POSIX C printf spec, a quick reference to substitutions is below.
STRING SUBSTITUTIONS
All string fields have a 'max width' parameter
%.3s
means 'print no more than three characters of the original input'
-
%s
: string -
%b
: escaped string - the string will be checked for any escaped literals from the escaped literal list above, and translate them to literal characters. e.g.\\n
will be transformed into a newline character. One special rule about%b
mode is that octal literals are interpreted differently In arguments passed by%b
, pass octal-interpreted literals must be in the form of\\0NNN
instead of\\NNN
. (Although, for legacy reasons, octal literals in the form of\\NNN
will still be interpreted and not throw a warning, you will have problems if you use this for a literal whose code begins with zero, as it will be viewed as in\\0NNN
form.) -
%q
: escaped string - the string in a format that can be reused as input by most shells. Non-printable characters are escaped with the POSIX proposed ‘$''’ syntax, and shell meta-characters are quoted appropriately. This is an equivalent format to ls --quoting=shell-escape output.
CHAR SUBSTITUTIONS
The character field does not have a secondary parameter.
%c
: a single character
INTEGER SUBSTITUTIONS
All integer fields have a 'pad with zero' parameter
%.4i
means an integer which if it is less than 4 digits in length,
is padded with leading zeros until it is 4 digits in length.
-
%d
or%i
: 64-bit integer -
%u
: 64-bit unsigned integer -
%x
or%X
: 64-bit unsigned integer printed in Hexadecimal (base 16)%X
instead of%x
means to use uppercase letters for 'a' through 'f' -
%o
: 64-bit unsigned integer printed in octal (base 8)
FLOATING POINT SUBSTITUTIONS
All floating point fields have a 'max decimal places / max significant digits' parameter
%.10f
means a decimal floating point with 7 decimal places past 0
%.10e
means a scientific notation number with 10 significant digits
%.10g
means the same behavior for decimal and Sci. Note, respectively, and provides the shortest
of each's output.
Like with GNU coreutils, the value after the decimal point is these outputs is parsed as a double first before being rendered to text. For both implementations do not expect meaningful precision past the 18th decimal place. When using a number of decimal places that is 18 or higher, you can expect variation in output between GNU coreutils printf and this printf at the 18th decimal place of +/- 1
-
%f
: floating point value presented in decimal, truncated and displayed to 6 decimal places by default. There is not past-double behavior parity with Coreutils printf, values are not estimated or adjusted beyond input values. -
%e
or%E
: floating point value presented in scientific notation 7 significant digits by default%E
means use to use uppercase E for the mantissa. -
%g
or%G
: floating point value presented in the shortest of decimal and scientific notation behaves differently from%f
and%E
, please see posix printf spec for full details, some examples of different behavior: Sci Note has 6 significant digits by default Trailing zeroes are removed Instead of being truncated, digit after last is rounded
Like other behavior in this utility, the design choices of floating point behavior in this utility is selected to reproduce in exact the behavior of GNU coreutils' printf from an inputs and outputs standpoint.
USING PARAMETERS
Most substitution fields can be parameterized using up to 2 numbers that can be passed to the field, between the % sign and the field letter.
The 1st parameter always indicates the minimum width of output, it is useful for creating columnar output. Any output that would be less than this minimum width is padded with leading spaces The 2nd parameter is proceeded by a dot. You do not have to use parameters
SPECIAL FORMS OF INPUT
For numeric input, the following additional forms of input are accepted besides decimal:
Octal (only with integer): if the argument begins with a 0 the proceeding characters will be interpreted as octal (base 8) for integer fields
Hexadecimal: if the argument begins with 0x the proceeding characters will be interpreted will be interpreted as hex (base 16) for any numeric fields for float fields, hexadecimal input results in a precision limit (in converting input past the decimal point) of 10^-15
Character Constant: if the argument begins with a single quote character, the first byte of the next character will be interpreted as an 8-bit unsigned integer. If there are additional bytes, they will throw an error (unless the environment variable POSIXLY_CORRECT is set)
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 the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
ptx
ptx [OPTION]... [INPUT]...
ptx -G [OPTION]... [INPUT [OUTPUT]]
Produce a permuted index of file contents Output a permuted index, including context, of the words in the input files. Mandatory arguments to long options are mandatory for short options too. With no FILE, or when FILE is -, read standard input. Default is '-F /'.
Options
--auto-reference
,-A
-
output automatically generated references
--traditional
,-G
-
behave more like System V 'ptx'
--flag-truncation=<STRING>
,-F <STRING>
-
use STRING for flagging line truncations
--macro-name=<STRING>
,-M <STRING>
-
macro name to use instead of 'xx'
--format=roff
,-O
-
generate output as roff directives
--right-side-refs
,-R
-
put references at right, not counted in -w
--sentence-regexp=<REGEXP>
,-S <REGEXP>
-
for end of lines or end of sentences
--format=tex
,-T
-
generate output as TeX directives
--word-regexp=<REGEXP>
,-W <REGEXP>
-
use REGEXP to match each keyword
--break-file=<FILE>
,-b <FILE>
-
word break characters in this FILE
--ignore-case
,-f
-
fold lower case to upper case for sorting
--gap-size=<NUMBER>
,-g <NUMBER>
-
gap size in columns between output fields
--ignore-file=<FILE>
,-i <FILE>
-
read ignore word list from FILE
--only-file=<FILE>
,-o <FILE>
-
read only word list from this FILE
--references=<FILE>
,-r <FILE>
-
first field of each line is a reference
--width=<NUMBER>
,-w <NUMBER>
-
output width in columns, reference excluded
Examples
Generate a permuted index where the first field of each line is an index reference:
ptx --references {{path/to/file}}
Generate a permuted index with automatically generated index references:
ptx --auto-reference {{path/to/file}}
Generate a permuted index with a fixed width:
ptx --width={{width_in_columns}} {{path/to/file}}
Generate a permuted index with a list of filtered words:
ptx --only-file={{path/to/filter}} {{path/to/file}}
Generate a permuted index with SYSV-style behaviors:
ptx --traditional {{path/to/file}}
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
pwd
pwd [OPTION]... [FILE]...
Display the full filename of the current working directory.
Options
--logical
,-L
-
use PWD from environment, even if it contains symlinks
--physical
,-P
-
avoid all symlinks
Examples
Print the current directory:
pwd
Print the current directory, and resolve all symlinks (i.e. show the "physical" path):
pwd -P
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
readlink
readlink [OPTION]... [FILE]...
Print value of a symbolic link or canonical file name.
Options
--canonicalize
,-f
-
canonicalize by following every symlink in every component of the given name recursively; all but the last component must exist
--canonicalize-existing
,-e
-
canonicalize by following every symlink in every component of the given name recursively, all components must exist
--canonicalize-missing
,-m
-
canonicalize by following every symlink in every component of the given name recursively, without requirements on components existence
--no-newline
,-n
-
do not output the trailing delimiter
--quiet
,-q
-
suppress most error messages
--silent
,-s
-
suppress most error messages
--verbose
,-v
-
report error message
--zero
,-z
-
separate output with NUL rather than newline
Examples
Get the actual file to which the symlink points:
readlink {{path/to/file}}
Get the absolute path to a file:
readlink -f {{path/to/file}}
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
realpath
realpath [OPTION]... FILE...
Print the resolved path
Options
--quiet
,-q
-
Do not print warnings for invalid paths
--strip
,--no-symlinks
,-s
-
Only strip '.' and '..' components, but don't resolve symbolic links
--zero
,-z
-
Separate output filenames with \0 rather than newline
--logical
,-L
-
resolve '..' components before symlinks
--physical
,-P
-
resolve symlinks as encountered (default)
--canonicalize-existing
,-e
-
canonicalize by following every symlink in every component of the given name recursively, all components must exist
--canonicalize-missing
,-m
-
canonicalize by following every symlink in every component of the given name recursively, without requirements on components existence
--relative-to=<DIR>
-
print the resolved path relative to DIR
--relative-base=<DIR>
-
print absolute paths unless paths below DIR
Examples
Display the absolute path for a file or directory:
realpath {{path/to/file_or_directory}}
Require all path components to exist:
realpath --canonicalize-existing {{path/to/file_or_directory}}
Resolve ".." components before symlinks:
realpath --logical {{path/to/file_or_directory}}
Disable symlink expansion:
realpath --no-symlinks {{path/to/file_or_directory}}
Suppress error messages:
realpath --quiet {{path/to/file_or_directory}}
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
rm
rm [OPTION]... FILE...
Remove (unlink) the FILE(s)
Options
--force
,-f
-
ignore nonexistent files and arguments, never prompt
-i
-
prompt before every removal
-I
-
prompt once before removing more than three files, or when removing recursively. Less intrusive than -i, while still giving some protection against most mistakes
--interactive=<WHEN>
-
prompt according to WHEN: never, once (-I), or always (-i). Without WHEN, prompts always
--one-file-system
-
when removing a hierarchy recursively, skip any directory that is on a file system different from that of the corresponding command line argument (NOT IMPLEMENTED)
--no-preserve-root
-
do not treat '/' specially
--preserve-root
-
do not remove '/' (default)
--recursive
,-r
,-R
-
remove directories and their contents recursively
--dir
,-d
-
remove empty directories
--verbose
,-v
-
explain what is being done
--presume-input-tty
By default, rm does not remove directories. Use the --recursive (-r or -R) option to remove each listed directory, too, along with all of its contents
To remove a file whose name starts with a '-', for example '-foo', use one of these commands: rm -- -foo
rm ./-foo
Note that if you use rm to remove a file, it might be possible to recover some of its contents, given sufficient expertise and/or time. For greater assurance that the contents are truly unrecoverable, consider using shred.
Examples
Remove specific files:
rm {{path/to/file1 path/to/file2 ...}}
Remove specific files ignoring nonexistent ones:
rm -f {{path/to/file1 path/to/file2 ...}}
Remove specific files interactively prompting before each removal:
rm -i {{path/to/file1 path/to/file2 ...}}
Remove specific files printing info about each removal:
rm -v {{path/to/file1 path/to/file2 ...}}
Remove specific files and directories recursively:
rm -r {{path/to/file_or_directory1 path/to/file_or_directory2 ...}}
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
rmdir
rmdir [OPTION]... DIRECTORY...
Remove the DIRECTORY(ies), if they are empty.
Options
--ignore-fail-on-non-empty
-
ignore each failure that is solely because a directory is non-empty
--parents
,-p
-
remove DIRECTORY and its ancestors; e.g.,
'rmdir -p a/b/c' is similar to rmdir a/b/c a/b a --verbose
,-v
-
output a diagnostic for every directory processed
Examples
Remove specific directories:
rmdir {{path/to/directory1 path/to/directory2 ...}}
Remove specific nested directories recursively:
rmdir -p {{path/to/directory1 path/to/directory2 ...}}
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
runcon
runcon [CONTEXT COMMAND [ARG...]]
runcon [-c] [-u USER] [-r ROLE] [-t TYPE] [-l RANGE] COMMAND [ARG...]
Run command with specified security context under SELinux enabled systems.
Options
--compute
,-c
-
Compute process transition context before modifying.
--user=<USER>
,-u <USER>
-
Set user USER in the target security context.
--role=<ROLE>
,-r <ROLE>
-
Set role ROLE in the target security context.
--type=<TYPE>
,-t <TYPE>
-
Set type TYPE in the target security context.
--range=<RANGE>
,-l <RANGE>
-
Set range RANGE in the target security context.
Run COMMAND with completely-specified CONTEXT, or with current or transitioned security context modified by one or more of LEVEL, ROLE, TYPE, and USER.
If none of --compute, --type, --user, --role or --range is specified, then the first argument is used as the complete context.
Note that only carefully-chosen contexts are likely to successfully run.
If neither CONTEXT nor COMMAND is specified, the current security context is printed.
Examples
Print the security context of the current execution context:
runcon
Specify the domain to run a command in:
runcon -t {{domain}}_t {{command}}
Specify the context role to run a command with:
runcon -r {{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 the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
seq
seq [OPTION]... LAST
seq [OPTION]... FIRST LAST
seq [OPTION]... FIRST INCREMENT LAST
Display numbers from FIRST to LAST, in steps of INCREMENT.
Options
--separator
,-s
-
Separator character (defaults to \n)
--terminator
,-t
-
Terminator character (defaults to \n)
--equal-width
,-w
-
Equalize widths of all numbers by padding with zeros
--format
,-f
-
use printf style floating-point 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 " " 5 3 20
Format output width to a minimum of 4 digits padding with zeros as necessary:
seq -f "%04g" 5 3 20
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
sha1sum
Options
--binary
,-b
-
read in binary mode
--check
,-c
-
read hashsums from the FILEs and check them
--tag
-
create a BSD-style checksum
--text
,-t
-
read in text mode (default)
--quiet
,-q
-
don't print OK for each successfully verified file
--status
,-s
-
don't output anything, status code shows success
--strict
-
exit non-zero for improperly formatted checksum lines
--ignore-missing
-
don't fail or report status for missing files
--warn
,-w
-
warn about improperly formatted checksum lines
--zero
,-z
-
end each output line with NUL, not newline
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 from stdin
:
{{command}} | sha1sum
Read a file of SHA1 sums and filenames and verify all files have matching checksums:
sha1sum --check {{path/to/file.sha1}}
Only show a message for missing files or when verification fails:
sha1sum --check --quiet {{path/to/file.sha1}}
Only show a message when verification fails, ignoring missing files:
sha1sum --ignore-missing --check --quiet {{path/to/file.sha1}}
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
sha224sum
Options
--binary
,-b
-
read in binary mode
--check
,-c
-
read hashsums from the FILEs and check them
--tag
-
create a BSD-style checksum
--text
,-t
-
read in text mode (default)
--quiet
,-q
-
don't print OK for each successfully verified file
--status
,-s
-
don't output anything, status code shows success
--strict
-
exit non-zero for improperly formatted checksum lines
--ignore-missing
-
don't fail or report status for missing files
--warn
,-w
-
warn about improperly formatted checksum lines
--zero
,-z
-
end each output line with NUL, not newline
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 from stdin
:
{{command}} | sha224sum
Read a file of SHA224 sums and filenames and verify all files have matching checksums:
sha224sum --check {{path/to/file.sha224}}
Only show a message for missing files or when verification fails:
sha224sum --check --quiet {{path/to/file.sha224}}
Only show a message when verification fails, ignoring missing files:
sha224sum --ignore-missing --check --quiet {{path/to/file.sha224}}
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
sha256sum
Options
--binary
,-b
-
read in binary mode
--check
,-c
-
read hashsums from the FILEs and check them
--tag
-
create a BSD-style checksum
--text
,-t
-
read in text mode (default)
--quiet
,-q
-
don't print OK for each successfully verified file
--status
,-s
-
don't output anything, status code shows success
--strict
-
exit non-zero for improperly formatted checksum lines
--ignore-missing
-
don't fail or report status for missing files
--warn
,-w
-
warn about improperly formatted checksum lines
--zero
,-z
-
end each output line with NUL, not newline
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 from stdin
:
{{command}} | sha256sum
Read a file of SHA256 checksums and filenames and verify all files have matching checksums:
sha256sum --check {{path/to/file.sha256}}
Only show a message for missing files or when verification fails:
sha256sum --check --quiet {{path/to/file.sha256}}
Only show a message when verification fails, ignoring missing files:
sha256sum --ignore-missing --check --quiet {{path/to/file.sha256}}
Check known SHA256 checksum of a file:
echo {{known_sha256_checksum_of_the_file}} {{path/to/file}} | sha256sum --check
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
sha3-224sum
Options
--binary
,-b
-
read in binary mode
--check
,-c
-
read hashsums from the FILEs and check them
--tag
-
create a BSD-style checksum
--text
,-t
-
read in text mode (default)
--quiet
,-q
-
don't print OK for each successfully verified file
--status
,-s
-
don't output anything, status code shows success
--strict
-
exit non-zero for improperly formatted checksum lines
--ignore-missing
-
don't fail or report status for missing files
--warn
,-w
-
warn about improperly formatted checksum lines
--zero
,-z
-
end each output line with NUL, not newline
sha3-256sum
Options
--binary
,-b
-
read in binary mode
--check
,-c
-
read hashsums from the FILEs and check them
--tag
-
create a BSD-style checksum
--text
,-t
-
read in text mode (default)
--quiet
,-q
-
don't print OK for each successfully verified file
--status
,-s
-
don't output anything, status code shows success
--strict
-
exit non-zero for improperly formatted checksum lines
--ignore-missing
-
don't fail or report status for missing files
--warn
,-w
-
warn about improperly formatted checksum lines
--zero
,-z
-
end each output line with NUL, not newline
sha3-384sum
Options
--binary
,-b
-
read in binary mode
--check
,-c
-
read hashsums from the FILEs and check them
--tag
-
create a BSD-style checksum
--text
,-t
-
read in text mode (default)
--quiet
,-q
-
don't print OK for each successfully verified file
--status
,-s
-
don't output anything, status code shows success
--strict
-
exit non-zero for improperly formatted checksum lines
--ignore-missing
-
don't fail or report status for missing files
--warn
,-w
-
warn about improperly formatted checksum lines
--zero
,-z
-
end each output line with NUL, not newline
sha3-512sum
Options
--binary
,-b
-
read in binary mode
--check
,-c
-
read hashsums from the FILEs and check them
--tag
-
create a BSD-style checksum
--text
,-t
-
read in text mode (default)
--quiet
,-q
-
don't print OK for each successfully verified file
--status
,-s
-
don't output anything, status code shows success
--strict
-
exit non-zero for improperly formatted checksum lines
--ignore-missing
-
don't fail or report status for missing files
--warn
,-w
-
warn about improperly formatted checksum lines
--zero
,-z
-
end each output line with NUL, not newline
sha384sum
Options
--binary
,-b
-
read in binary mode
--check
,-c
-
read hashsums from the FILEs and check them
--tag
-
create a BSD-style checksum
--text
,-t
-
read in text mode (default)
--quiet
,-q
-
don't print OK for each successfully verified file
--status
,-s
-
don't output anything, status code shows success
--strict
-
exit non-zero for improperly formatted checksum lines
--ignore-missing
-
don't fail or report status for missing files
--warn
,-w
-
warn about improperly formatted checksum lines
--zero
,-z
-
end each output line with NUL, not newline
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 from stdin
:
{{command}} | sha384sum
Read a file of SHA384 sums and filenames and verify all files have matching checksums:
sha384sum --check {{path/to/file.sha384}}
Only show a message for missing files or when verification fails:
sha384sum --check --quiet {{path/to/file.sha384}}
Only show a message when verification fails, ignoring missing files:
sha384sum --ignore-missing --check --quiet {{path/to/file.sha384}}
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
sha3sum
Options
--binary
,-b
-
read in binary mode
--check
,-c
-
read hashsums from the FILEs and check them
--tag
-
create a BSD-style checksum
--text
,-t
-
read in text mode (default)
--quiet
,-q
-
don't print OK for each successfully verified file
--status
,-s
-
don't output anything, status code shows success
--strict
-
exit non-zero for improperly formatted checksum lines
--ignore-missing
-
don't fail or report status for missing files
--warn
,-w
-
warn about improperly formatted checksum lines
--zero
,-z
-
end each output line with NUL, not newline
--bits=<BITS>
-
set the size of the output (only for SHAKE)
sha512sum
Options
--binary
,-b
-
read in binary mode
--check
,-c
-
read hashsums from the FILEs and check them
--tag
-
create a BSD-style checksum
--text
,-t
-
read in text mode (default)
--quiet
,-q
-
don't print OK for each successfully verified file
--status
,-s
-
don't output anything, status code shows success
--strict
-
exit non-zero for improperly formatted checksum lines
--ignore-missing
-
don't fail or report status for missing files
--warn
,-w
-
warn about improperly formatted checksum lines
--zero
,-z
-
end each output line with NUL, not newline
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 from stdin
:
{{command}} | sha512sum
Read a file of SHA512 sums and filenames and verify all files have matching checksums:
sha512sum --check {{path/to/file.sha512}}
Only show a message for missing files or when verification fails:
sha512sum --check --quiet {{path/to/file.sha512}}
Only show a message when verification fails, ignoring missing files:
sha512sum --ignore-missing --check --quiet {{path/to/file.sha512}}
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
shake128sum
Options
--binary
,-b
-
read in binary mode
--check
,-c
-
read hashsums from the FILEs and check them
--tag
-
create a BSD-style checksum
--text
,-t
-
read in text mode (default)
--quiet
,-q
-
don't print OK for each successfully verified file
--status
,-s
-
don't output anything, status code shows success
--strict
-
exit non-zero for improperly formatted checksum lines
--ignore-missing
-
don't fail or report status for missing files
--warn
,-w
-
warn about improperly formatted checksum lines
--zero
,-z
-
end each output line with NUL, not newline
--bits=<BITS>
-
set the size of the output (only for SHAKE)
shake256sum
Options
--binary
,-b
-
read in binary mode
--check
,-c
-
read hashsums from the FILEs and check them
--tag
-
create a BSD-style checksum
--text
,-t
-
read in text mode (default)
--quiet
,-q
-
don't print OK for each successfully verified file
--status
,-s
-
don't output anything, status code shows success
--strict
-
exit non-zero for improperly formatted checksum lines
--ignore-missing
-
don't fail or report status for missing files
--warn
,-w
-
warn about improperly formatted checksum lines
--zero
,-z
-
end each output line with NUL, not newline
--bits=<BITS>
-
set the size of the output (only for SHAKE)
shred
shred [OPTION]... FILE...
Overwrite the specified FILE(s) repeatedly, in order to make it harder for even very expensive hardware probing to recover the data.
Options
--force
,-f
-
change permissions to allow writing if necessary
--iterations=<NUMBER>
,-n <NUMBER>
-
overwrite N times instead of the default (3)
--size=<N>
,-s <N>
-
shred this many bytes (suffixes like K, M, G accepted)
-u
-
deallocate and remove file after overwriting
--remove=<HOW>
-
like -u but give control on HOW to delete; See below
--verbose
,-v
-
show progress
--exact
,-x
-
do not round file sizes up to the next full block;
this is the default for non-regular files --zero
,-z
-
add a final overwrite with zeros to hide shredding
Delete FILE(s)
if --remove
(-u
) is specified. The default is not to remove
the files because it is common to operate on device files like /dev/hda
, and
those files usually should not be removed.
CAUTION: Note that shred relies on a very important assumption: that the file system overwrites data in place. This is the traditional way to do things, but many modern file system designs do not satisfy this assumption. The following are examples of file systems on which shred is not effective, or is not guaranteed to be effective in all file system modes:
-
log-structured or journal file systems, such as those supplied with AIX and Solaris (and JFS, ReiserFS, XFS, Ext3, etc.)
-
file systems that write redundant data and carry on even if some writes fail, such as RAID-based file systems
-
file systems that make snapshots, such as Network Appliance's NFS server
-
file systems that cache in temporary locations, such as NFS version 3 clients
-
compressed file systems
In the case of ext3 file systems, the above disclaimer applies (and shred is
thus of limited effectiveness) only in data=journal
mode, which journals file
data in addition to just metadata. In both the data=ordered
(default) and
data=writeback
modes, shred works as usual. Ext3 journal modes can be changed
by adding the data=something
option to the mount options for a particular
file system in the /etc/fstab
file, as documented in the mount man page (man mount
).
In addition, file system backups and remote mirrors may contain copies of the file that cannot be removed, and that will allow a shredded file to be recovered later.
Examples
Overwrite a file:
shred {{path/to/file}}
Overwrite a file and show progress on the screen:
shred --verbose {{path/to/file}}
Overwrite a file, leaving [z]eros instead of random data:
shred --zero {{path/to/file}}
Overwrite a file a specific [n]umber of times:
shred --iterations {{25}} {{path/to/file}}
Overwrite a file and remove it:
shred --remove {{path/to/file}}
Overwrite a file 100 times, add a final overwrite with [z]eros, remove the file after overwriting it and show [v]erbose progress on the screen:
shred -vzun 100 {{path/to/file}}
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
shuf
shuf [OPTION]... [FILE]
shuf -e [OPTION]... [ARG]...
shuf -i LO-HI [OPTION]...
Shuffle the input by outputting a random permutation of input lines. Each output permutation is equally likely. With no FILE, or when FILE is -, read standard input.
Options
--echo
,-e
-
treat each ARG as an input line
--input-range=<LO-HI>
,-i <LO-HI>
-
treat each number LO through HI as an input line
--head-count=<COUNT>
,-n <COUNT>
-
output at most COUNT lines
--output=<FILE>
,-o <FILE>
-
write result to FILE instead of standard output
--random-source=<FILE>
-
get random bytes from FILE
--repeat
,-r
-
output lines can be repeated
--zero-terminated
,-z
-
line delimiter is NUL, not newline
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 --head-count=5 {{path/to/file}}
Write the output to another file:
shuf {{path/to/input_file}} --output={{path/to/output_file}}
Generate 3 random numbers in the range 1-10 (inclusive):
shuf --head-count=3 --input-range=1-10 --repeat
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
sleep
sleep NUMBER[SUFFIX]...
sleep OPTION
Pause for NUMBER seconds.
Options
-
pause for NUMBER seconds
Pause for NUMBER seconds. SUFFIX may be 's' for seconds (the default), 'm' for minutes, 'h' for hours or 'd' for days. Unlike most implementations that require NUMBER be an integer, here NUMBER may be an arbitrary floating point number. Given two or more arguments, pause for the amount of time specified by the sum of their values.
Examples
Delay in seconds:
sleep {{seconds}}
Execute a specific command after 20 seconds delay:
sleep 20 && {{command}}
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
sort
sort [OPTION]... [FILE]...
Display sorted concatenation of all FILE(s). With no FILE, or when FILE is -, read standard input.
Options
--help
-
Print help information.
--version
-
Print version information.
--sort
--human-numeric-sort
,-h
-
compare according to human readable sizes, eg 1M > 100k
--month-sort
,-M
-
compare according to month name abbreviation
--numeric-sort
,-n
-
compare according to string numerical value
--general-numeric-sort
,-g
-
compare according to string general numerical value
--version-sort
,-V
-
Sort by SemVer version number, eg 1.12.2 > 1.1.2
--random-sort
,-R
-
shuffle in random order
--dictionary-order
,-d
-
consider only blanks and alphanumeric characters
--merge
,-m
-
merge already sorted files; do not sort
--check
,-c
-
check for sorted input; do not sort
--check-silent
,-C
-
exit successfully if the given file is already sorted, and exit with status 1 otherwise.
--ignore-case
,-f
-
fold lower case to upper case characters
--ignore-nonprinting
,-i
-
ignore nonprinting characters
--ignore-leading-blanks
,-b
-
ignore leading blanks when finding sort keys in each line
--output=<FILENAME>
,-o <FILENAME>
-
write output to FILENAME instead of stdout
--reverse
,-r
-
reverse the output
--stable
,-s
-
stabilize sort by disabling last-resort comparison
--unique
,-u
-
output only the first of an equal run
--key
,-k
-
sort by a key
--field-separator
,-t
-
custom separator for -k
--zero-terminated
,-z
-
line delimiter is NUL, not newline
--parallel=<NUM_THREADS>
-
change the number of threads running concurrently to NUM_THREADS
--buffer-size=<SIZE>
,-S <SIZE>
-
sets the maximum SIZE of each segment in number of sorted items
--temporary-directory=<DIR>
,-T <DIR>
-
use DIR for temporaries, not $TMPDIR or /tmp
--compress-program=<PROG>
-
compress temporary files with PROG, decompress with PROG -d; PROG has to take input from stdin and output to stdout
--batch-size=<N_MERGE>
-
Merge at most N_MERGE inputs at once.
--files0-from=<NUL_FILES>
-
read input from the files specified by NUL-terminated NUL_FILES
--debug
-
underline the parts of the line that are actually used for sorting
The key format is FIELD[.CHAR][OPTIONS][,FIELD[.CHAR]][OPTIONS]
.
Fields by default are separated by the first whitespace after a non-whitespace character. Use -t
to specify a custom separator.
In the default case, whitespace is appended at the beginning of each field. Custom separators however are not included in fields.
FIELD
and CHAR
both start at 1 (i.e. they are 1-indexed). If there is no end specified after a comma, the end will be the end of the line.
If CHAR
is set 0, it means the end of the field. CHAR
defaults to 1 for the start position and to 0 for the end position.
Valid options are: MbdfhnRrV
. They override the global options for this key.
Examples
Sort a file in ascending order:
sort {{path/to/file}}
Sort a file in descending order:
sort --reverse {{path/to/file}}
Sort a file in case-insensitive way:
sort --ignore-case {{path/to/file}}
Sort a file using numeric rather than alphabetic order:
sort --numeric-sort {{path/to/file}}
Sort /etc/passwd
by the 3rd field of each line numerically, using ":" as a field separator:
sort --field-separator={{:}} --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 {{:}} -k {{3,3n}} -k {{4,4g}} {{/etc/passwd}}
Sort a file preserving only unique lines:
sort --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 --output={{path/to/file}} {{path/to/file}}
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
split
split [OPTION]... [INPUT [PREFIX]]
Create output files containing consecutive or interleaved sections of input
Options
--bytes=<SIZE>
,-b <SIZE>
-
put SIZE bytes per output file
--line-bytes=<SIZE>
,-C <SIZE>
-
put at most SIZE bytes of lines per output file
--lines=<NUMBER>
,-l <NUMBER>
-
put NUMBER lines/records per output file
--number=<CHUNKS>
,-n <CHUNKS>
-
generate CHUNKS output files; see explanation below
--additional-suffix=<SUFFIX>
-
additional SUFFIX to append to output file names
--filter=<COMMAND>
-
write to shell COMMAND; file name is $FILE (Currently not implemented for Windows)
--elide-empty-files
,-e
-
do not generate empty output files with '-n'
-d
-
use numeric suffixes starting at 0, not alphabetic
--numeric-suffixes=<FROM>
-
same as -d, but allow setting the start value
-x
-
use hex suffixes starting at 0, not alphabetic
--hex-suffixes=<FROM>
-
same as -x, but allow setting the start value
--suffix-length=<N>
,-a <N>
-
generate suffixes of length N (default 2)
--verbose
-
print a diagnostic just before each output file is opened
--separator=<SEP>
,-t <SEP>
-
use SEP instead of newline as the record separator; '\0' (zero) specifies the NUL character
--io-blksize
Output fixed-size pieces of INPUT to PREFIXaa, PREFIXab, ...; default size is 1000, and default PREFIX is 'x'. With no INPUT, or when INPUT is -, read standard input.
The SIZE argument is an integer and optional unit (example: 10K is 10*1024). Units are K,M,G,T,P,E,Z,Y,R,Q (powers of 1024) or KB,MB,... (powers of 1000). Binary prefixes can be used, too: KiB=K, MiB=M, and so on.
CHUNKS may be:
- N split into N files based on size of input
- K/N output Kth of N to stdout
- l/N split into N files without splitting lines/records
- l/K/N output Kth of N to stdout without splitting lines/records
- r/N like 'l' but use round robin distribution
- r/K/N likewise but only output Kth of N to stdout
Examples
Split a file, each split having 10 lines (except the last split):
split -l 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 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 512 {{path/to/file}}
Split a file with at most 512 bytes in each split without breaking lines:
split -C 512 {{path/to/file}}
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
stat
stat [OPTION]... FILE...
Display file or file system status.
Options
--dereference
,-L
-
follow links
--file-system
,-f
-
display file system status instead of file status
--terse
,-t
-
print the information in terse form
--format=<FORMAT>
,-c <FORMAT>
-
use the specified FORMAT instead of the default;
output a newline after each use of FORMAT --printf=<FORMAT>
-
like --format, but interpret backslash escapes,
and do not output a mandatory trailing newline;
if you want a newline, include
in FORMAT
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 --terse {{path/to/file}}
Display information about the filesystem where a specific file is located:
stat --file-system {{path/to/file}}
Show only octal file permissions:
stat --format="%a %n" {{path/to/file}}
Show the owner and group of a specific file:
stat --format="%U %G" {{path/to/file}}
Show the size of a specific file in bytes:
stat --format="%s %n" {{path/to/file}}
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
stdbuf
stdbuf [OPTION]... COMMAND
Run COMMAND
, with modified buffering operations for its standard streams.
Mandatory arguments to long options are mandatory for short options too.
Options
--input=<MODE>
,-i <MODE>
-
adjust standard input stream buffering
--output=<MODE>
,-o <MODE>
-
adjust standard output stream buffering
--error=<MODE>
,-e <MODE>
-
adjust standard error stream buffering
If MODE
is 'L' the corresponding stream will be line buffered.
This option is invalid with standard input.
If MODE
is '0' the corresponding stream will be unbuffered.
Otherwise, MODE
is a number which may be followed by one of the following:
KB 1000, K 1024, MB 10001000, M 10241024, and so on for G, T, P, E, Z, Y.
In this case the corresponding stream will be fully buffered with the buffer size set to MODE
bytes.
NOTE: If COMMAND
adjusts the buffering of its standard streams (tee
does for e.g.) then that will override corresponding settings changed by stdbuf
.
Also some filters (like dd
and cat
etc.) don't use streams for I/O, and are thus unaffected by stdbuf
settings.
Examples
Change stdin
buffer size to 512 KiB:
stdbuf --input=512K {{command}}
Change stdout
buffer to line-buffered:
stdbuf --output=L {{command}}
Change stderr
buffer to unbuffered:
stdbuf --error=0 {{command}}
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
stty
stty [-F DEVICE | --file=DEVICE] [SETTING]...
stty [-F DEVICE | --file=DEVICE] [-a|--all]
stty [-F DEVICE | --file=DEVICE] [-g|--save]
Print or change terminal characteristics.
Options
--all
,-a
-
print all current settings in human-readable form
--save
,-g
-
print all current settings in a stty-readable form
--file=<DEVICE>
,-F <DEVICE>
-
open and use the specified DEVICE instead of stdin
-
settings to change
Examples
Display all settings for the current terminal:
stty --all
Set the number of rows or columns:
stty {{rows|cols}} {{count}}
Get the actual transfer speed of a device:
stty --file {{path/to/device_file}} speed
Reset all modes to reasonable values for the current terminal:
stty sane
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
sum
sum [OPTION]... [FILE]...
Checksum and count the blocks in a file.
With no FILE, or when FILE is -, read standard input.
Options
-r
-
use the BSD sum algorithm, use 1K blocks (default)
--sysv
,-s
-
use System V sum algorithm, use 512 bytes blocks
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 --sysv {{path/to/file}}
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
sync
sync [OPTION]... FILE...
Synchronize cached writes to persistent storage
Options
--file-system
,-f
-
sync the file systems that contain the files (Linux and Windows only)
--data
,-d
-
sync only file data, no unneeded metadata (Linux only)
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}}
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
tac
tac [OPTION]... [FILE]...
Write each file to standard output, last line first.
Options
--before
,-b
-
attach the separator before instead of after
--regex
,-r
-
interpret the sequence as a regular expression
--separator=<STRING>
,-s <STRING>
-
use STRING as the separator instead of newline
Examples
Concatenate specific files in reversed order:
tac {{path/to/file1 path/to/file2 ...}}
Display stdin
in reversed order:
{{cat path/to/file}} | tac
Use a specific [s]eparator:
tac -s {{separator}} {{path/to/file1 path/to/file2 ...}}
Use a specific [r]egex as a [s]eparator:
tac -r -s {{separator}} {{path/to/file1 path/to/file2 ...}}
Use a separator [b]efore each file:
tac -b {{path/to/file1 path/to/file2 ...}}
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
tail
tail [FLAG]... [FILE]...
Print the last 10 lines of each FILE to standard output. With more than one FILE, precede each with a header giving the file name. With no FILE, or when FILE is -, read standard input.
Mandatory arguments to long flags are mandatory for short flags too.
Options
--bytes
,-c
-
Number of bytes to print
--follow
,-f
-
Print the file as it grows
--lines
,-n
-
Number of lines to print
--pid=<PID>
-
With -f, terminate after process ID, PID dies
--quiet
,--silent
,-q
-
Never output headers giving file names
--sleep-interval=<N>
,-s <N>
-
Number of seconds to sleep between polling the file when running with -f
--max-unchanged-stats=<N>
-
Reopen a FILE which has not changed size after N (default 5) iterations to see if it has been unlinked or renamed (this is the usual case of rotated log files); This option is meaningful only when polling (i.e., with --use-polling) and when --follow=name
--verbose
,-v
-
Always output headers giving file names
--zero-terminated
,-z
-
Line delimiter is NUL, not newline
--use-polling
-
Disable 'inotify' support and use polling instead
--retry
-
Keep trying to open a file if it is inaccessible
-F
-
Same as --follow=name --retry
--presume-input-pipe
Examples
Show last 'count' lines in file:
tail --lines {{count}} {{path/to/file}}
Print a file from a specific line number:
tail --lines +{{count}} {{path/to/file}}
Print a specific count of bytes from the end of a given file:
tail --bytes {{count}} {{path/to/file}}
Print the last lines of a given file and keep reading it until Ctrl + C
:
tail --follow {{path/to/file}}
Keep reading file until Ctrl + C
, even if the file is inaccessible:
tail --retry --follow {{path/to/file}}
Show last 'num' lines in 'file' and refresh every 'n' seconds:
tail --lines {{count}} --sleep-interval {{seconds}} --follow {{path/to/file}}
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
tee
tee [OPTION]... [FILE]...
Copy standard input to each FILE, and also to standard output.
Options
--help
,-h
-
Print help
--append
,-a
-
append to the given FILEs, do not overwrite
--ignore-interrupts
,-i
-
ignore interrupt signals (ignored on non-Unix platforms)
-p
-
set write error behavior (ignored on non-Unix platforms)
--output-error
-
set write error behavior
If a FILE is -, it refers to a file named - .
Examples
Copy stdin
to each file, and also to stdout
:
echo "example" | tee {{path/to/file}}
Append to the given files, do not overwrite:
echo "example" | tee -a {{path/to/file}}
Print stdin
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)
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
test
test EXPRESSION
test
test EXPRESSION ]
test ]
test OPTION
test
Check file types and compare values.
Options
Exit with the status determined by EXPRESSION
.
An omitted EXPRESSION
defaults to false.
Otherwise, EXPRESSION
is true or false and sets exit status.
It is one of:
- ( EXPRESSION )
EXPRESSION
is true - ! EXPRESSION
EXPRESSION
is false - EXPRESSION1 -a EXPRESSION2 both
EXPRESSION1
andEXPRESSION2
are true - EXPRESSION1 -o EXPRESSION2 either
EXPRESSION1
orEXPRESSION2
is true
String operations:
- -n STRING the length of
STRING
is nonzero - STRING equivalent to -n
STRING
- -z STRING the length of
STRING
is zero - STRING1 = STRING2 the strings are equal
- STRING1 != STRING2 the strings are not equal
Integer comparisons:
- INTEGER1 -eq INTEGER2
INTEGER1
is equal toINTEGER2
- INTEGER1 -ge INTEGER2
INTEGER1
is greater than or equal toINTEGER2
- INTEGER1 -gt INTEGER2
INTEGER1
is greater thanINTEGER2
- INTEGER1 -le INTEGER2
INTEGER1
is less than or equal toINTEGER2
- INTEGER1 -lt INTEGER2
INTEGER1
is less thanINTEGER2
- INTEGER1 -ne INTEGER2
INTEGER1
is not equal toINTEGER2
File operations:
-
FILE1 -ef FILE2
FILE1
andFILE2
have the same device and inode numbers -
FILE1 -nt FILE2
FILE1
is newer (modification date) thanFILE2
-
FILE1 -ot FILE2
FILE1
is older thanFILE2
-
-b FILE
FILE
exists and is block special -
-c FILE
FILE
exists and is character special -
-d FILE
FILE
exists and is a directory -
-e FILE
FILE
exists -
-f FILE
FILE
exists and is a regular file -
-g FILE
FILE
exists and is set-group-ID -
-G FILE
FILE
exists and is owned by the effective group ID -
-h FILE
FILE
exists and is a symbolic link (same as -L) -
-k FILE
FILE
exists and has its sticky bit set -
-L FILE
FILE
exists and is a symbolic link (same as -h) -
-N FILE
FILE
exists and has been modified since it was last read -
-O FILE
FILE
exists and is owned by the effective user ID -
-p FILE
FILE
exists and is a named pipe -
-r FILE
FILE
exists and read permission is granted -
-s FILE
FILE
exists and has a size greater than zero -
-S FILE
FILE
exists and is a socket -
-t FD
file
descriptorFD
is opened on a terminal -
-u FILE
FILE
exists and its set-user-ID bit is set -
-w FILE
FILE
exists and write permission is granted -
-x FILE
FILE
exists and execute (or search) permission is granted
Except for -h
and -L
, all FILE-related tests dereference (follow) symbolic links.
Beware that parentheses need to be escaped (e.g., by backslashes) for shells.
INTEGER
may also be -l STRING
, which evaluates to the length of STRING
.
NOTE: Binary -a
and -o
are inherently ambiguous.
Use test EXPR1 && test EXPR2
or test EXPR1 || test EXPR2
instead.
NOTE: [
honors the --help
and --version
options, but test does not.
test treats each of those as it treats any other nonempty STRING
.
NOTE: your shell may have its own version of test
and/or [
, which usually supersedes the version described here.
Please refer to your shell's documentation for details about the options it supports.
Examples
Test if a given variable is equal to a given string:
test "{{$MY_VAR}}" = "{{/bin/zsh}}"
Test if a given variable is empty:
test -z "{{$GIT_BRANCH}}"
Test if a file exists:
test -f "{{path/to/file_or_directory}}"
Test if a directory 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"}}
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
timeout
timeout [OPTION] DURATION COMMAND...
Start COMMAND
, and kill it if still running after DURATION
.
Options
--foreground
-
when not running timeout directly from a shell prompt, allow COMMAND to read from the TTY and get TTY signals; in this mode, children of COMMAND will not be timed out
--kill-after
,-k
-
also send a KILL signal if COMMAND is still running this long after the initial signal was sent
--preserve-status
-
exit with the same status as COMMAND, even when the command times out
--signal=<SIGNAL>
,-s <SIGNAL>
-
specify the signal to be sent on timeout; SIGNAL may be a name like 'HUP' or a number; see 'kill -l' for a list of signals
--verbose
,-v
-
diagnose to stderr any signal sent upon timeout
Examples
Run sleep 10
and terminate it after 3 seconds:
timeout 3s sleep 10
Send a [s]ignal to the command after the time limit expires (TERM
by default, kill -l
to list all signals):
timeout --signal {{INT|HUP|KILL|...}} {{5s}} {{sleep 10}}
Send [v]erbose output to stderr
showing signal sent upon timeout:
timeout --verbose {{0.5s|1m|1h|1d|...}} {{command}}
Preserve the exit status of the command regardless of timing out:
timeout --preserve-status {{1s|1m|1h|1d|...}} {{command}}
Send a forceful KILL
signal after certain duration if the command ignores initial signal upon timeout:
timeout --kill-after={{5m}} {{30s}} {{command}}
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
touch
touch [OPTION]... [USER]
Update the access and modification times of each FILE
to the current time.
Options
--help
-
Print help information.
-a
-
change only the access time
-t <STAMP>
-
use [[CC]YY]MMDDhhmm[.ss] instead of the current time
--date=<STRING>
,-d <STRING>
-
parse argument and use it instead of current time
-m
-
change only the modification time
--no-create
,-c
-
do not create any files
--no-dereference
,-h
-
affect each symbolic link instead of any referenced file (only for systems that can change the timestamps of a symlink)
--reference=<FILE>
,-r <FILE>
-
use this file's times instead of the current time
--time=<WORD>
-
change only the specified time: "access", "atime", or "use" are equivalent to -a; "modify" or "mtime" are equivalent to -m
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 [c]reate file if it doesn't exist:
touch -c -{{a|m}} {{path/to/file1 path/to/file2 ...}}
Set the file [t]ime to a specific value and don't [c]reate file if it doesn't exist:
touch -c -t {{YYYYMMDDHHMM.SS}} {{path/to/file1 path/to/file2 ...}}
Set the files' timestamp to the [r]eference file's timestamp, and do not [c]reate the file if it does not exist:
touch -c -r {{path/to/reference_file}} {{path/to/file1 path/to/file2 ...}}
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
tr
tr [OPTION]... SET1 [SET2]
Translate or delete characters
Options
--complement
,-c
,-C
-
use the complement of SET1
--delete
,-d
-
delete characters in SET1, do not translate
--squeeze-repeats
,-s
-
replace each sequence of a repeated character that is listed in the last specified SET, with a single occurrence of that character
--truncate-set1
,-t
-
first truncate SET1 to length of SET2
Translate, squeeze, and/or delete characters from standard input, writing to standard output.
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 '{{input_characters}}' < {{path/to/file}}
Compress a series of identical characters to a single character:
tr -s '{{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 "[:print:]" < {{path/to/file}}
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
true
true
Returns true, a successful exit status.
Immediately returns with the exit status 0
, except when invoked with one of the recognized
options. In those cases it will try to write the help or version text. Any IO error during this
operation causes the program to return 1
instead.
Options
--help
-
Print help information
--version
-
Print version information
Examples
Return a successful exit code:
true
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
truncate
truncate [OPTION]... [FILE]...
Shrink or extend the size of each file to the specified size.
Options
--io-blocks
,-o
-
treat SIZE as the number of I/O blocks of the file rather than bytes (NOT IMPLEMENTED)
--no-create
,-c
-
do not create files that do not exist
--reference=<RFILE>
,-r <RFILE>
-
base the size of each file on the size of RFILE
--size=<SIZE>
,-s <SIZE>
-
set or adjust the size of each file according to SIZE, which is in bytes unless --io-blocks is specified
SIZE is an integer with an optional prefix and optional unit. The available units (K, M, G, T, P, E, Z, and Y) use the following format: 'KB' => 1000 (kilobytes) 'K' => 1024 (kibibytes) 'MB' => 10001000 (megabytes) 'M' => 10241024 (mebibytes) 'GB' => 100010001000 (gigabytes) 'G' => 102410241024 (gibibytes) SIZE may also be prefixed by one of the following to adjust the size of each file based on its current size: '+' => extend by '-' => reduce by '<' => at most '>' => at least '/' => round down to multiple of '%' => round up to multiple of
Examples
Set a size of 10 GB to an existing file, or create a new file with the specified size:
truncate --size 10G {{path/to/file}}
Extend the file size by 50 MiB, fill with holes (which reads as zero bytes):
truncate --size +50M {{path/to/file}}
Shrink the file by 2 GiB, by removing data from the end of file:
truncate --size -2G {{path/to/file}}
Empty the file's content:
truncate --size 0 {{path/to/file}}
Empty the file's content, but do not create the file if it does not exist:
truncate --no-create --size 0 {{path/to/file}}
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
tsort
tsort [OPTIONS] FILE
Topological sort the strings in FILE. Strings are defined as any sequence of tokens separated by whitespace (tab, space, or newline), ordering them based on dependencies in a directed acyclic graph (DAG). Useful for scheduling and determining execution order. If FILE is not passed in, stdin is used instead.
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 the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
tty
tty [OPTION]...
Print the file name of the terminal connected to standard input.
Options
--silent
,--quiet
,-s
-
print nothing, only return an exit status
Examples
Print the file name of this terminal:
tty
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
uname
uname [OPTION]...
Print certain system information. With no OPTION, same as -s.
Options
--all
,-a
-
Behave as though all of the options -mnrsvo were specified.
--kernel-name
,-s
-
print the kernel name.
--nodename
,-n
-
print the nodename (the nodename may be a name that the system is known by to a communications network).
--kernel-release
,-r
-
print the operating system release.
--kernel-version
,-v
-
print the operating system version.
--machine
,-m
-
print the machine hardware name.
--operating-system
,-o
-
print the operating system name.
--processor
,-p
-
print the processor type (non-portable)
--hardware-platform
,-i
-
print the hardware platform (non-portable)
Examples
Print kernel name:
uname
Print system architecture and processor information:
uname --machine --processor
Print kernel name, kernel release and kernel version:
uname --kernel-name --kernel-release --kernel-version
Print system hostname:
uname --nodename
Print all available system information:
uname --all
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
unexpand
unexpand [OPTION]... [FILE]...
Convert blanks in each FILE
to tabs, writing to standard output.
With no FILE
, or when FILE
is -
, read standard input.
Options
--all
,-a
-
convert all blanks, instead of just initial blanks
--first-only
-
convert only leading sequences of blanks (overrides -a)
--tabs=<N, LIST>
,-t <N, LIST>
-
use comma separated LIST of tab positions or have tabs N characters apart instead of 8 (enables -a)
--no-utf8
,-U
-
interpret input file as 8-bit ASCII rather than UTF-8
Examples
Convert blanks in each file to tabs, writing to stdout
:
unexpand {{path/to/file}}
Convert blanks to tabs, reading from stdout
:
unexpand
Convert all blanks, instead of just initial blanks:
unexpand -a {{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 {{number}} {{path/to/file}}
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
uniq
uniq [OPTION]... [INPUT [OUTPUT]]
Report or omit repeated lines.
Options
--all-repeated=<delimit-method>
,-D <delimit-method>
-
print all duplicate lines. Delimiting is done with blank lines. [default: none]
--group=<group-method>
-
show all items, separating groups with an empty line. [default: separate]
--check-chars=<N>
,-w <N>
-
compare no more than N characters in lines
--count
,-c
-
prefix lines by the number of occurrences
--ignore-case
,-i
-
ignore differences in case when comparing
--repeated
,-d
-
only print duplicate lines
--skip-chars=<N>
,-s <N>
-
avoid comparing the first N characters
--skip-fields=<N>
,-f <N>
-
avoid comparing the first N fields
--unique
,-u
-
only print unique lines
--zero-terminated
,-z
-
end lines with 0 byte, not newline
Filter adjacent matching lines from INPUT
(or standard input),
writing to OUTPUT
(or standard output).
Note: uniq
does not detect repeated lines unless they are adjacent.
You may want to sort the input first, or use sort -u
without uniq
.
Examples
Display each line once:
sort {{path/to/file}} | uniq
Display only unique lines:
sort {{path/to/file}} | uniq -u
Display only duplicate lines:
sort {{path/to/file}} | uniq -d
Display number of occurrences of each line along with that line:
sort {{path/to/file}} | uniq -c
Display number of occurrences of each line, sorted by the most frequent:
sort {{path/to/file}} | uniq -c | sort -nr
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
unlink
unlink [FILE]
unlink OPTION
Unlink the file at FILE
.
Options
Examples
Remove the specified file if it is the last link:
unlink {{path/to/file}}
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
uptime
uptime [OPTION]...
Display the current time, the length of time the system has been up, the number of users on the system, and the average number of jobs in the run queue over the last 1, 5 and 15 minutes.
Options
--since
,-s
-
system up since
-
file to search boot time from
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 --pretty
Print the date and time the system booted up at:
uptime --since
Display version:
uptime --version
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
users
users [FILE]
Print the user names of users currently logged in to the current host.
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 the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
vdir
vdir [OPTION]... [FILE]...
List directory contents. Ignore files and directories starting with a '.' by default.
Mandatory arguments to long options are mandatory for short options too.
Options
--help
-
Print help information.
--format
-
Set the display format.
-C
-
Display the files in columns.
--long
,-l
-
Display detailed information.
-x
-
List entries in rows instead of in columns.
--tabsize=<COLS>
,-T <COLS>
-
Assume tab stops at each COLS instead of 8 (unimplemented)
-m
-
List entries separated by commas.
--zero
-
List entries separated by ASCII NUL characters.
--dired
,-D
-
generate output designed for Emacs' dired (Directory Editor) mode
--hyperlink=<WHEN>
-
hyperlink file names WHEN
-1
-
List one file per line.
-o
-
Long format without group information. Identical to --format=long with --no-group.
-g
-
Long format without owner information.
--numeric-uid-gid
,-n
-
-l with numeric UIDs and GIDs.
--quoting-style
-
Set quoting style.
--literal
,-N
-
Use literal quoting style. Equivalent to
--quoting-style=literal
--escape
,-b
-
Use escape quoting style. Equivalent to
--quoting-style=escape
--quote-name
,-Q
-
Use C quoting style. Equivalent to
--quoting-style=c
--hide-control-chars
,-q
-
Replace control characters with '?' if they are not escaped.
--show-control-chars
-
Show control characters 'as is' if they are not escaped.
--time=<field>
-
Show time in
:
access time (-u): atime, access, use;
change time (-t): ctime, status.
birth time: birth, creation; -c
-
If the long listing format (e.g., -l, -o) is being used, print the status change time (the 'ctime' in the inode) instead of the modification time. When explicitly sorting by time (--sort=time or -t) or when not using a long listing format, sort according to the status change time.
-u
-
If the long listing format (e.g., -l, -o) is being used, print the status access time instead of the modification time. When explicitly sorting by time (--sort=time or -t) or when not using a long listing format, sort according to the access time.
--hide=<PATTERN>
-
do not list implied entries matching shell PATTERN (overridden by -a or -A)
--ignore=<PATTERN>
,-I <PATTERN>
-
do not list implied entries matching shell PATTERN
--ignore-backups
,-B
-
Ignore entries which end with ~.
--sort=<field>
-
Sort by
: name, none (-U), time (-t), size (-S), extension (-X) or width -S
-
Sort by file size, largest first.
-t
-
Sort by modification time (the 'mtime' in the inode), newest first.
-v
-
Natural sort of (version) numbers in the filenames.
-X
-
Sort alphabetically by entry extension.
-U
-
Do not sort; list the files in whatever order they are stored in the directory. This is especially useful when listing very large directories, since not doing any sorting can be noticeably faster.
--dereference
,-L
-
When showing file information for a symbolic link, show information for the file the link references rather than the link itself.
--dereference-command-line-symlink-to-dir
-
Do not follow symlinks except when they link to directories and are given as command line arguments.
--dereference-command-line
,-H
-
Do not follow symlinks except when given as command line arguments.
--no-group
,-G
-
Do not show group in long format.
--author
-
Show author in long format. On the supported platforms, the author always matches the file owner.
--all
,-a
-
Do not ignore hidden files (files with names that start with '.').
--almost-all
,-A
-
In a directory, do not ignore all file names that start with '.', only ignore '.' and '..'.
--directory
,-d
-
Only list the names of directories, rather than listing directory contents. This will not follow symbolic links unless one of
--dereference-command-line (-H)
,--dereference (-L)
, or--dereference-command-line-symlink-to-dir
is specified. --human-readable
,-h
-
Print human readable file sizes (e.g. 1K 234M 56G).
--kibibytes
,-k
-
default to 1024-byte blocks for file system usage; used only with -s and per directory totals
--si
-
Print human readable file sizes using powers of 1000 instead of 1024.
--block-size=<BLOCK_SIZE>
-
scale sizes by BLOCK_SIZE when printing them
--inode
,-i
-
print the index number of each file
--reverse
,-r
-
Reverse whatever the sorting method is e.g., list files in reverse alphabetical order, youngest first, smallest first, or whatever.
--recursive
,-R
-
List the contents of all directories recursively.
--width=<COLS>
,-w <COLS>
-
Assume that the terminal is COLS columns wide.
--size
,-s
-
print the allocated size of each file, in blocks
--color
-
Color output based on file type.
--indicator-style
-
Append indicator with style WORD to entry names: none (default), slash (-p), file-type (--file-type), classify (-F)
--classify=<when>
,-F <when>
-
Append a character to each file name indicating the file type. Also, for regular files that are executable, append '*'. The file type indicators are '/' for directories, '@' for symbolic links, '|' for FIFOs, '=' for sockets, '>' for doors, and nothing for regular files. when may be omitted, or one of:
none - Do not classify. This is the default.
auto - Only classify if standard output is a terminal.
always - Always classify.
Specifying --classify and no when is equivalent to --classify=always. This will not follow symbolic links listed on the command line unless the --dereference-command-line (-H), --dereference (-L), or --dereference-command-line-symlink-to-dir options are specified. --file-type
-
Same as --classify, but do not append '*'
-p
-
Append / indicator to directories.
--time-style=<TIME_STYLE>
-
time/date format with -l; see TIME_STYLE below
--full-time
-
like -l --time-style=full-iso
--context
,-Z
-
print any security context of each file
--group-directories-first
-
group directories before files; can be augmented with a --sort option, but any use of --sort=none (-U) disables grouping
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
List including hidden files (starting with a dot):
vdir -a
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 --recursive {{path/to/directory}}
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
wc
wc [OPTION]... [FILE]...
Display newline, word, and byte counts for each FILE, and a total line if more than one FILE is specified. With no FILE, or when FILE is -, read standard input.
Options
--bytes
,-c
-
print the byte counts
--chars
,-m
-
print the character counts
--files0-from=<F>
-
read input from the files specified by
NUL-terminated names in file F;
If F is - then read names from standard input --lines
,-l
-
print the newline counts
--max-line-length
,-L
-
print the length of the longest line
--total=<WHEN>
-
when to print a line with total counts;
WHEN can be: auto, always, only, never --words
,-w
-
print the word counts
Examples
Count all lines in a file:
wc --lines {{path/to/file}}
Count all words in a file:
wc --words {{path/to/file}}
Count all bytes in a file:
wc --bytes {{path/to/file}}
Count all characters in a file (taking multi-byte characters into account):
wc --chars {{path/to/file}}
Count all lines, words and bytes from stdin
:
{{find .}} | wc
Count the length of the longest line in number of characters:
wc --max-line-length {{path/to/file}}
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
who
who [OPTION]... [ FILE | ARG1 ARG2 ]
Print information about users who are currently logged in.
Options
--all
,-a
-
same as -b -d --login -p -r -t -T -u
--boot
,-b
-
time of last system boot
--dead
,-d
-
print dead processes
--heading
,-H
-
print line of column headings
--login
,-l
-
print system login processes
--lookup
-
attempt to canonicalize hostnames via DNS
-m
-
only hostname and user associated with stdin
--process
,-p
-
print active processes spawned by init
--count
,-q
-
all login names and number of users logged on
--runlevel
,-r
-
print current runlevel
--short
,-s
-
print only name, line, and time (default)
--time
,-t
-
print last system clock change
--users
,-u
-
list users logged in
--mesg
,--message
,--writable
,-T
,-w
-
add user's message status as +, - or ?
Examples
Display the username, line, and time of all currently logged-in sessions:
who
Display all available information:
who -a
Display all available information with table headers:
who -a -H
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
whoami
whoami
Print the current username.
Options
Examples
Display currently logged username:
whoami
Display the username after a change in the user ID:
sudo whoami
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.
yes
yes [STRING]...
Repeatedly display a line with STRING (or 'y')
Options
Examples
Repeatedly output "message":
yes {{message}}
Repeatedly output "y":
yes
Accept everything prompted by the apt-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 the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.