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, with batch execution and privilege escalation. Uses the remote shell by default; choose an interpreter with --interpreter, for example --interpreter bash --launch-dialect posix.

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 --host host1 -- uptime
  xops exec --tag web -c "uptime"
  xops exec -I hosts.txt --shell script.sh
  xops exec --tag web --shell script.sh -- arg1 "arg 2"

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.
  The --host, --ifile (-I), and --tag selectors are mutually exclusive; choose one and use --exclude to narrow its targets.
Notes:
  - -x requires local terminal input and a single host; incompatible with --shell, --stream and --out-dir.
  - Scripts and Unix escalation require bash/sh/zsh/fish; --no-login is Bash-only.
  - Explicit non-interactive execution defaults to a 5-minute timeout; buffered results retain only the last 5 MiB.

Usage:
  xops exec [flags] [command] [-- [arg...]]

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)
      --interpreter string      Remote execution interpreter: server (remote default shell), bash, sh, zsh, fish, powershell, pwsh or cmd
  -J, --jump string             Jump host address, supports Node/Alias, FQDN, IP, or [user@]host[:port]
      --launch-dialect string   Server launch dialect: unknown, posix, fish, powershell or cmd; Bash/sh/zsh/fish require posix or fish
  -l, --login string            SSH login username
      --login-shell             Enable/disable login for an explicit Bash/zsh/fish interpreter; incompatible with server and --no-login
      --no-login                Do not load login shell (prevents welcome messages/MOTD)
      --otp string              One-time password (OTP/2FA) token for the session
      --otp-stdin               Read one-time password (OTP) from standard input
      --out-dir string          Directory to save output to per-host log files
      --passphrase-stdin        Read passphrase securely from stdin to avoid exposure in command arguments
      --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)
      --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