Skip to content

xops exec

Command usage and available options are listed below. Check --help for options supported by your installed version.

text
Execute commands on one or more remote hosts. Supports batch execution and privilege escalation.

Usage examples (OpenSSH-compatible):
  xops exec -l root -p 22 192.168.1.11 "uptime"
  xops exec -i ~/.ssh/id_rsa -J bastion.example.com 192.168.1.11 "df -h"
  xops exec root@192.168.1.11 "uptime"

Batch execution:
  xops exec --host host1,host2 -c "uptime"
  xops exec --tag web -c "uptime"
  xops exec -I hosts.txt --shell script.sh

Connection Target Semantics:
  Explicit user and port prioritize full-target matching, automatically reuse existing Host records, strictly isolate Identity credentials, consistent with ssh/sftp/scp.
  ProxyJump (-J) resolution strategy: Prioritizes saved Node, Alias, or ~/.ssh/config Host; direct jump targets explicitly require Node/Alias, FQDN, IP, or host:port; single-label hostnames without port must be configured as a Node/Alias first.
  When using --tag, other host specification methods are ignored.

Usage:
  xops exec [flags] [command]

Flags:
      --alias string        Connection alias
  -c, --cmd string          Command to execute
      --exclude strings     Exclude specified hosts (supports Node ID / alias / IP / User@Host, comma separated or specified multiple times)
  -h, --help                help for exec
      --host string         Target hosts, comma separated
  -i, --identity string     SSH identity (private key) file path
  -I, --ifile string        Host list file
  -x, --interactive         Interactive mode (supports tail -f, vim, top, etc. Single host only)
  -J, --jump string         Jump host address, supports Node/Alias, FQDN, IP, or [user@]host[:port]
  -l, --login string        SSH login username
      --no-login            Do not load login shell (prevents welcome messages/MOTD)
      --out-dir string      Directory to save output to per-host log files
      --passphrase string   SSH private key passphrase
      --passphrase-stdin    Read passphrase securely from stdin to avoid exposure in command arguments
      --password string     SSH password
      --password-stdin      Read password securely from stdin to avoid exposure in command arguments
  -p, --port uint16         SSH port
      --remember string     Credential persistence policy: ask, always, never; inherits credential.remember_prompted, then ask; batch mode never saves
      --shell string        Local shell script file
      --stream              Enable real-time stream output (adds host prefix in multi-host mode)
      --suPwd string        Password for su to root
      --sudo                Execute with sudo
      --tag string          Execute by group (tag)
      --task int            Number of parallel hosts (default 3)

Global Flags:
      --color string       ANSI color output (auto=detect pipe/redirect, never=disable, always=force enable)
      --debug              Enable debug mode (equivalent to --log-level=debug)
      --lang string        Interface language (zh/en)
      --log-level string   Set internal diagnostic log level (debug, info, warn, error)

MIT License