← 返回命令列表

Linux command

pssh 命令

网络

需要网络或远程资源。

常用示例

Run command on multiple hosts

pssh -h [hosts.txt] -i "[uptime]"

Run with inline hosts

pssh -H "[user@host1] [user@host2]" -i "[command]"

Run with parallel limit

pssh -h [hosts.txt] -p [10] -i "[command]"

Run with timeout

pssh -h [hosts.txt] -t [30] -i "[command]"

Copy file to hosts

pscp -h [hosts.txt] [local_file] [/remote/path]

Copy file from hosts

pslurp -h [hosts.txt] [/remote/file] [local_dir]

Run interactively

pssh -h [hosts.txt] -i -A "[sudo command]"

说明

pssh (Parallel SSH) runs commands on multiple hosts simultaneously. It parallelizes SSH connections for faster execution across large server fleets. Host files list target machines, one per line. Format supports user@host:port syntax. Comments start with #. Parallel limit controls concurrent connections. Too many simultaneous connections may overwhelm networks or hosts. Start conservatively. Output modes collect results differently. Inline (-i) shows output as it arrives. Directory mode (-o) saves per-host output files. Related tools include pscp for parallel file copy to hosts, pslurp for parallel file retrieval, and prsync for parallel rsync. Timeout prevents hanging on unresponsive hosts. Failed hosts are reported separately from successful ones.

参数

-h _FILE_
File with hosts (one per line).
-H _HOSTS_
Space-separated hosts.
-l _USER_
Default username.
-p _NUM_
Max parallel connections.
-t _SECONDS_
Timeout per host.
-i, --inline
Display output inline.
-o _DIR_
Output directory.
-e _DIR_
Error output directory.
-A
Prompt for password.
-O _OPTS_
SSH options.
-x _ARGS_
Extra SSH arguments.
-v
Verbose mode.

FAQ

What is the pssh command used for?

pssh (Parallel SSH) runs commands on multiple hosts simultaneously. It parallelizes SSH connections for faster execution across large server fleets. Host files list target machines, one per line. Format supports user@host:port syntax. Comments start with #. Parallel limit controls concurrent connections. Too many simultaneous connections may overwhelm networks or hosts. Start conservatively. Output modes collect results differently. Inline (-i) shows output as it arrives. Directory mode (-o) saves per-host output files. Related tools include pscp for parallel file copy to hosts, pslurp for parallel file retrieval, and prsync for parallel rsync. Timeout prevents hanging on unresponsive hosts. Failed hosts are reported separately from successful ones.

How do I run a basic pssh example?

Run `pssh -h [hosts.txt] -i "[uptime]"` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -h _FILE_ do in pssh?

File with hosts (one per line).