Linux command
pdsh 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Run a command
pdsh -w [host1,host2,host3] [command]
Use a host range
pdsh -w [host[1-10]] [command]
Force the SSH
pdsh -R ssh -w [hosts] [command]
Read target hosts from a file
pdsh -w ^[hosts.txt] [command]
Limit the fanout
pdsh -f [16] -w [hosts] [command]
Pipe output through dshbak
pdsh -w [hosts] [command] | dshbak -c
说明
pdsh is a high-performance, parallel remote shell utility. It launches the requested command on many hosts in parallel and merges their stdout/stderr back to the user, prefixed with each host's name. It was developed at LLNL for cluster administration and supports multiple "remote command modules" (ssh, rsh, mrsh, etc.) selected at build time or via -R. Targets can be supplied as explicit lists, compressed numeric ranges, files, dshgroups, or via genders/SLURM modules. The companion utilities pdcp (parallel copy), rpdcp (reverse parallel copy), and dshbak (group identical output across hosts) round out a small toolkit aimed at scripted cluster operations.
参数
- -w _HOSTS_
- Target host list. Accepts comma-separated names, compressed ranges (host1-10), or `^file` to read from a file.
- -x _HOSTS_
- Exclude these hosts from the target list.
- -R _MODULE_
- Remote command module: `ssh`, `rsh`, `mrsh`, `exec`, `krb4`, etc. Default depends on build.
- -l _USER_
- Remote username to log in as.
- -t _SECONDS_
- Connect timeout per host. Default: 10.
- -u _SECONDS_
- Per-host command timeout (kills slow commands).
- -f _NUMBER_
- Maximum number of concurrent (fanout) connections. Default: 32.
- -N
- Suppress the "hostname:" prefix on each line of output.
- -S
- Return the largest remote exit status as the pdsh exit code.
- -g _GROUP_
- Run on a host group defined in dshgroup or genders.
- -a
- Target all hosts (requires a working host module like genders or machines).
- -q
- Display the list of targeted hosts and exit without running.
FAQ
What is the pdsh command used for?
pdsh is a high-performance, parallel remote shell utility. It launches the requested command on many hosts in parallel and merges their stdout/stderr back to the user, prefixed with each host's name. It was developed at LLNL for cluster administration and supports multiple "remote command modules" (ssh, rsh, mrsh, etc.) selected at build time or via -R. Targets can be supplied as explicit lists, compressed numeric ranges, files, dshgroups, or via genders/SLURM modules. The companion utilities pdcp (parallel copy), rpdcp (reverse parallel copy), and dshbak (group identical output across hosts) round out a small toolkit aimed at scripted cluster operations.
How do I run a basic pdsh example?
Run `pdsh -w [host1,host2,host3] [command]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -w _HOSTS_ do in pdsh?
Target host list. Accepts comma-separated names, compressed ranges (host1-10), or `^file` to read from a file.