LinuxCommandLibrary

xe

Simple command execution from stdin

TLDR

Execute for each line

$ cat [list.txt] | xe [command] {}
copy
Parallel execution
$ cat [urls.txt] | xe -j [4] curl {}
copy
Replace string
$ xe -a [file1] [file2] -- mv {} {}.bak
copy
With null separator
$ find . -print0 | xe -0 echo {}
copy
Limit processes
$ xe -N [10] -a [*.txt] -- process {}
copy

SYNOPSIS

xe [-j jobs] [-a args] [-0] [options] command

DESCRIPTION

xe is a simple command execution tool designed as a more intuitive alternative to xargs. It reads input line by line from stdin and executes a specified command for each line, using {} as a placeholder for the input value.
The tool supports parallel execution through the -j option, allowing multiple jobs to run concurrently for improved throughput. It can also accept arguments directly via -a instead of reading from stdin, and supports null-delimited input with -0 for handling filenames with spaces or special characters.
Compared to xargs, xe provides a cleaner syntax with simpler placeholder substitution and more predictable behavior. It is designed to work naturally in shell pipelines, making it straightforward to process streams of data by applying commands to each input element.

PARAMETERS

-j JOBS

Parallel jobs.
-a ARGS
Arguments.
-0
Null separator.
-N NUM
Max processes.
{}
Placeholder.

CAVEATS

Different from xargs. Simpler feature set. Part of moreutils sometimes.

HISTORY

xe was created as a simpler, more intuitive alternative to xargs for command execution.

SEE ALSO

xargs(1), parallel(1), find(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community