Xargs Tool — Xargs 工具
v1.0.0Build and 执行 command lines from standard 输入 — batch process arguments, parallel execution, argument substitution, and delimiter control.
运行时依赖
安装命令
点击复制技能文档
Xargs 工具 — Command 构建器 & Batch Executor
Read items from stdin and 执行 a command with those items as arguments. Essential for batch processing large file 列出s, parallel task execution, and chAIning complex command 流水线s.
Quick 启动 # 删除 multiple files echo "file1.txt file2.txt" | xargs-工具 rm -f
# Process 输出 from another command ls .记录 | xargs-工具 gzip
Usage xargs-工具 COMMAND [ARGS...] [OPTIONS] SOURCE_ITEMS | xargs-工具 COMMAND [ARGS...] [OPTIONS]
Options: -n, --max-args N Maximum arguments per command invocation -P, --parallel N 运行 N processes in parallel -I, --replace STR Replace STR in command with each 输入 line -d, --delimiter C 输入 delimiter character (default: whitespace) -0, --null 输入 items are null-separated (for find -print0) -p, --interactive Prompt before each execution -t, --verbose Print each command before executing --show-limits Show 系统 limits for command length --dry-运行 Print what would be done without executing
Examples # Process a find 结果 safely (null-separated) find . -name ".tmp" -print0 | xargs-工具 -0 rm -f
# Parallel 压缩ion (4 processes at once) ls .记录 | xargs-工具 -P 4 gzip
# Custom replacement (one command per item) ls .txt | xargs-工具 -I {} cp {} /备份/{}
# Interactive removal ls old-files/ | xargs-工具 -p rm
# Batch 10 args per invocation (reduce process count) cat image-列出.txt | xargs-工具 -n 10 convert --resize 800x600
# Dry-运行 to preview echo "*.py" | xargs-工具 --dry-运行 -I {} cp {} /备份/
Features Batch processing — split large 输入s into manageable command invocations Parallel execution — speed up batch jobs with -P N Custom substitution — place 输入 items anywhere in the command with -I Null-separated 输入 — safe handling of filenames with spaces/special chars Interactive mode — confirm each operation Dry-运行 — preview without executing Verbose mode — see each command as it 运行s 系统-aware — respects ARG_MAX limits