# Created on savesnippets.com · https://savesnippets.com/ERoQTRt1vACvCs HOSTS=(web1 web2 web3 db1) # Serial — slow but easy to reason about for h in "${HOSTS[@]}"; do echo "─── $h ───" ssh -n "$h" uptime done # Parallel with xargs (limit to 8 concurrent) printf '%s\n' "${HOSTS[@]}" | xargs -P 8 -I{} ssh -n -o ConnectTimeout=5 {} uptime # GNU parallel (cleaner output, must be installed) parallel -j 8 ssh {} uptime ::: "${HOSTS[@]}" # pssh — built specifically for this pssh -h hosts.txt -i 'uptime'