LinuxCommandLibrary

pssh

TLDR

Run command on multiple hosts

$ pssh -h [hosts.txt] -i "[uptime]"
copy
Run with inline hosts
$ pssh -H "[user@host1] [user@host2]" -i "[command]"
copy
Run with parallel limit
$ pssh -h [hosts.txt] -p [10] -i "[command]"
copy
Run with timeout
$ pssh -h [hosts.txt] -t [30] -i "[command]"
copy
Copy file to hosts
$ pscp -h [hosts.txt] [local_file] [/remote/path]
copy
Copy file from hosts
$ pslurp -h [hosts.txt] [/remote/file] [local_dir]
copy
Run interactively
$ pssh -h [hosts.txt] -i -A "[sudo command]"
copy

SYNOPSIS

pssh [-h hostfile] [-H hosts] [-p parallel] [-t timeout] [-i] [options] command

DESCRIPTION

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.

PARAMETERS

-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.

CAVEATS

Requires SSH key auth for non-interactive use. Password prompt (-A) is interactive. Large parallel counts may cause issues. Hostnames must resolve.

HISTORY

pssh was created by Brent N. Chun at Intel Research around 2007. It addressed the need for efficient multi-host command execution in cluster and cloud environments.

SEE ALSO

ssh(1), pdsh(1), ansible(1), clusterssh(1)

Copied to clipboard