A Go rewrite of moreutils: A collection of the Unix tools that nobody thought to write long ago when Unix was young.
Some of the original moreutils commands require Perl, so I decided to rewrite them in a language which can compile into a single binary with no dependencies.
- chronic: Runs a command quietly unless it fails
- combine: Combine sets of lines from two files using boolean operations
- errno: Look up errno names and descriptions
- ifdata: Get network interface info without parsing ifconfig output
- ifne: Run a command if the standard input is not empty
- isutf8: Check whether files are valid UTF-8
- mispipe: Pipe two commands, returning the exit status of the first
- parallel: Run multiple jobs at once
- pee: Tee standard input to pipes
- sponge: Soak up standard input and write to a file
- ts: Timestamp standard input
- vidir: Edit a directory in your text editor
- vipe: Insert a text editor into a pipe
- zrun: Automatically decompress arguments to command
Click to expand
-
If you don't have it already, install the
ca-certificates
packagesudo apt install ca-certificates
-
Add gabe565 apt repository
echo 'deb [trusted=yes] https://apt.gabe565.com /' | sudo tee /etc/apt/sources.list.d/gabe565.list
-
Update apt repositories
sudo apt update
-
Install moreutils-go
sudo apt install moreutils-go
Click to expand
-
If you don't have it already, install the
ca-certificates
packagesudo dnf install ca-certificates
-
Add gabe565 rpm repository to
/etc/yum.repos.d/gabe565.repo
[gabe565] name=gabe565 baseurl=https://rpm.gabe565.com enabled=1 gpgcheck=0
-
Install moreutils-go
sudo dnf install moreutils-go
Click to expand
Install moreutils-go-bin with your AUR helper of choice.
Click to expand
Install moreutils-go from gabe565/homebrew-tap:
brew install gabe565/tap/moreutils-go
Click to expand
This repository can be added to a GitHub Actions workflow to install the applets.
name: Example
on: push
jobs:
example:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: gabe565/moreutils-go@v0
- run: echo hello world | ts
Click to expand
A Docker image is available at ghcr.io/gabe565/moreutils
In this container, all applets are in the root directory.
Some commands can be run directly from a terminal:
echo hello world | docker run --rm -i ghcr.io/gabe565/moreutils ts
If you are building a container and need one of the applets, you can copy them directly to your container during build:
FROM alpine
COPY --from=ghcr.io/gabe565/moreutils:0 /usr/bin/ts /usr/bin
CMD echo hello world | ts
Click to expand
- Download and run the latest release binary for your system and architecture.
- Extract the binary and place it in the desired directory.
- Run
moreutils install -sr DIRECTORY
to generate symlinks for each command.
My goal is 100% compatability, but there are currently some differences compared to moreutils:
Applet | Differences |
---|---|
errno | The original implementation prints some errors which are not used by the current OS. For example, code 35 could match EAGAIN and EWOULDBLOCK . Most operating systems only use one or the other, so this implementation does not print duplicates. |
ifdata | The rewrite supports the -ph and -pf flags on all operating systems, and all statistics flags on Linux and Darwin. |
isutf8 | Unlike moreutils, which prints the expected value range for non-UTF-8 files, the rewrite only logs the offending line, byte, and char. |
lckdo | Deprecated in moreutils and intentionally not implemented here. It is recommended to use flock as a replacement. |
parallel | Parallel is not symlinked by default since GNU Parallel is typically preferred. |
ts | The -m flag does not affect functionality since Go always uses the system's monotonic clock. |