360 Secure SkillHub
360 安全技能中心

Xargs Tool

该 Skill 提供 xargs-tool 命令,读取标准输入中的参数项,按指定批次、并行度、替换字符串或分隔符构建并执行外部命令;支持空字符分隔、交互确认、详细输出、系统限制查询和 dry-run 预览。示例涉及 rm、gzip、cp、convert 等命令,具备文件操作和破坏性执行能力。

dinghaibin
dinghaibin
热度 26.72
最近更新 2026-05-15 00:31:46
分类:自动化依赖:代码执行 / 读写文件应用场景:自动化脚本 / 工作流

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add xargs-tool
Metadata
name
xargs-tool
description
Build and execute command lines from standard input — batch process arguments, parallel execution, argument substitution, and delimiter control.

Xargs Tool — Command Builder & Batch Executor

Read items from stdin and execute a command with those items as arguments. Essential for batch processing large file lists, parallel task execution, and chaining complex command pipelines.

Quick Start

# Delete multiple files
echo "file1.txt file2.txt" | xargs-tool rm -f

# Process output from another command
ls *.log | xargs-tool gzip

Usage

xargs-tool COMMAND [ARGS...] [OPTIONS]
SOURCE_ITEMS | xargs-tool COMMAND [ARGS...] [OPTIONS]

Options:
  -n, --max-args N    Maximum arguments per command invocation
  -P, --parallel N    Run N processes in parallel
  -I, --replace STR   Replace STR in command with each input line
  -d, --delimiter C   Input delimiter character (default: whitespace)
  -0, --null          Input items are null-separated (for find -print0)
  -p, --interactive   Prompt before each execution
  -t, --verbose       Print each command before executing
  --show-limits       Show system limits for command length
  --dry-run           Print what would be done without executing

Examples

# Process a find result safely (null-separated)
find . -name "*.tmp" -print0 | xargs-tool -0 rm -f

# Parallel compression (4 processes at once)
ls *.log | xargs-tool -P 4 gzip

# Custom replacement (one command per item)
ls *.txt | xargs-tool -I {} cp {} /backup/{}

# Interactive removal
ls old-files/ | xargs-tool -p rm

# Batch 10 args per invocation (reduce process count)
cat image-list.txt | xargs-tool -n 10 convert --resize 800x600

# Dry-run to preview
echo "*.py" | xargs-tool --dry-run -I {} cp {} /backup/

Features

  • Batch processing — split large inputs into manageable command invocations
  • Parallel execution — speed up batch jobs with -P N
  • Custom substitution — place input items anywhere in the command with -I
  • Null-separated input — safe handling of filenames with spaces/special chars
  • Interactive mode — confirm each operation
  • Dry-run — preview without executing
  • Verbose mode — see each command as it runs
  • System-aware — respects ARG_MAX limits