LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

pssh

Run commands on multiple hosts in parallel

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.

INSTALL

sudo dnf install pssh
copy
sudo apk add pssh
copy
sudo zypper install pssh
copy
brew install pssh
copy
nix profile install nixpkgs#pssh
copy

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)

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid