pdsh(1)
π NAME π
okay bestie, welcome to the pdsh(1) manual page β yes it's filed under the General Commands Manual but it's really all about these two icons:
pdcpβ copy files to groups of hosts in parallel π«Άrpdcpβ (reverse pdcp) copy files from a group of hosts in parallel
π SYNOPSIS π
pdcp [options]... src [src2...] dest
rpdcp [options]... src [src2...] dir
β¨ DESCRIPTION β¨
So pdcp is literally a variant of the rcp(1) command. But here's the glow-up: rcp(1) copies files to one single remote host, and pdcp copies files to multiple remote hosts in parallel. main character energy fr fr.
β οΈ but no cap: pdcp does not recognize files in the format ``rname@rhost:path,'' so all source files must be on the local host machine. no remote sources, periodt.
Destination nodes must be listed on the pdcp command line using a suitable target nodelist option (peep the OPTIONS section below π). And every single destination node you list must have pdcp installed, otherwise the copy just won't succeed. π
okay now the drama part. When pdcp receives SIGINT (that's ctrl-C bestie), it lists the status of current threads. A second SIGINT within one second terminates the program. Pending threads may be canceled by issuing ctrl-Z within one second of ctrl-C. And "pending threads" means the ones that haven't been initiated yet, or that are still in the process of connecting to the remote host. iykyk. π
Just like pdsh(1), the functionality of pdcp may be supplemented by dynamically loadable modules. In pdcp, those modules can provide:
- a new connect protocol (replacing the standard
rsh(1)protocol) - filtering options (e.g. excluding hosts that are down)
- and/or host selection options (e.g.
-aselects all nodes from a local config file)
By default, pdcp requires at least one "rcmd" module to be loaded (to provide the channel for remote copy). no module, no copy, simple as that π
π REVERSE PDCP π
rpdcp performs a reverse parallel copy. Instead of copying files to remote hosts, files are retrieved from remote hosts and stored locally. obsessed.
Every directory or file that gets retrieved will be stored with its remote hostname appended to the filename. And the destination file must be a directory when this option is used.
In all other respects, rpdcp is exactly like pdcp, so literally everything else in this manual about pdcp also applies to rpdcp. π«Ά
π§ RCMD MODULES π§
The method by which pdcp connects to remote hosts may be selected at runtime using the -R option (see OPTIONS below). This is ultimately implemented via dynamically loadable modules, so the list of available options may be different from installation to installation. π
A list of currently available rcmd modules is printed when using any of the -h, -V, or -L options. The default rcmd module will also be displayed with the -h and -V options.
Here's the list of rcmd modules currently distributed with pdcp:
rshβ uses an internal, thread-safe implementation of BSDrcmd(3)to run commands using the standardrsh(1)protocol.sshβ uses a variant ofpopen(3)to run multiple copies of thessh(1)command. β¨mrshβ this module uses themrsh(1)protocol to execute jobs on remote hosts. The mrsh protocol uses a credential based authentication, forgoing the need to allocate reserved ports. In other aspects, it acts just likersh.krb4β the krb4 module allows users to execute remote commands after authenticating with kerberos. Of course, the remotershddaemons must be kerberized. πxcpuβ the xcpu module uses the xcpu service to execute remote commands.
πΈ OPTIONS πΈ
The list of available pdcp options is determined at runtime by supplementing the list of standard pdcp options with any options provided by loaded rcmd and misc modules. In some cases, options provided by modules may conflict with each other. In those cases, the modules are incompatible and the first module loaded wins.
π Standard target nodelist options π
-w TARGETS,...β target and or filter the specified list of hosts. Do not use with any other node selection options (e.g.-a,-g, if they are available). No spaces are allowed in the comma-separated list. Arguments in the TARGETS list may include normal host names, a range of hosts in hostlist format (see HOSTLIST EXPRESSIONS), or a single-character to read the list of hosts on stdin.
If a host or hostlist is preceded by a - character, this causes those hosts to be explicitly excluded. If the argument is preceded by a single ^ character, it is taken to be the path to a file containing a list of hosts, one per line. If the item begins with a / character, it is taken as a regular expression on which to filter the list of hosts (a regex argument may also be optionally trailed by another /, e.g. /node.*/). A regex or file name argument may also be preceeded by a minus - to exclude instead of include thoses hosts.
A list of hosts may also be preceded by "user@" to specify a remote username other than the default, or "rcmd_type:" to specify an alternate rcmd connection type for these hosts. When used together, the rcmd type must be specified first, e.g. "ssh:user1@host0" would use ssh to connect to host0 as user "user1." π
-x host,host,...β exclude the specified hosts. May be specified in conjunction with other target node list options such as-aand-g(when available). Hostlists may also be specified to the-xoption (see the HOSTLIST EXPRESSIONS section below). Arguments to-xmay also be preceeded by the filename (^) and regex (/) characters as described above, in which case the resulting hosts are excluded as if they had been given to-wand preceeded with the minus-character.
π¦ Standard pdcp options π¦
-hβ output usage menu and quit. A list of available rcmd modules will be printed at the end of the usage message.-qβ list option values and the target nodelist and exit without action. (no notes, just vibes π«Ά)-bβ disable the ctrl-C status feature so that a single ctrl-C kills the parallel copy. (Batch Mode)-rβ copy directories recursively.-pβ preserve modification time and modes.-e PATHβ explicitly specify path to the remotepdcpbinary instead of using the locally executed path. Can also be set via the environment variablePDSH_REMOTE_PDCP_PATH.-l userβ this option may be used to copy files as another user, subject to authorization. For BSD rcmd, this means the invoking user and system must be listed in the userΒ΄s.rhostsfile (even for root). π-t secondsβ set the connect timeout. Default is 10 seconds.-f numberβ set the maximum number of simultaneous remote copies tonumber. The default is 32.-R nameβ set rcmd module toname. This option may also be set via thePDSH_RCMD_TYPEenvironment variable. A list of available rcmd modules may be obtained via either the-hor-Loptions.-M name,...β when multiple misc modules provide the same options to pdsh, the first module initialized "wins" and subsequent modules are not loaded. The-Moption allows a list of modules to be specified that will be force-initialized before all others, in-effect ensuring that they load without conflict (unless they conflict with each other). This option may also be set via thePDSH_MISC_MODULESenvironment variable.-Lβ list info on all loadedpdcpmodules and quit.-dβ include more complete thread status whenSIGINTis received, and display connect and command time statistics on stderr when done. Also, display any module loading errors on stderr, including option conflicts.-Vβ outputpdcpversion information, along with a list of currently loaded modules, and exit.
π HOSTLIST EXPRESSIONS π
As noted in the sections above, pdcp accepts ranges of hostnames in the general form:
prefix[n-m,l-k,...]
where n < m and l < k, etc., as an alternative to explicit lists of hosts. This form should not be confused with regular expression character classes (also denoted by ``[]''). For example, foo[19] does not represent foo1 or foo9, but rather represents a degenerate range: foo19. π
This range syntax is meant only as a convenience on clusters with a prefixNN naming convention, and specification of ranges should not be considered necessary β the list foo1,foo9 could be specified as such, or by the range foo[1,9]. either way bestie, we slay.
Some examples of range usage follow:
Copy /etc/hosts to foo01,foo02,...,foo05
pdcp -w foo[01-05] /etc/hosts /etc
Copy /etc/hosts to foo7,foo9,foo10
pdcp -w foo[7,9-10] /etc/hosts /etc
Copy /etc/hosts to foo0,foo4,foo5
pdcp -w foo[0-5] -x foo[1-3] /etc/hosts /etc
As a reminder to the reader (that's you π«΅), some shells will interpret brackets ([ and ]) for pattern matching. Depending on your shell, it may be necessary to enclose ranged lists within quotes. For example, in tcsh, the first example above should be executed as:
pdcp -w "foo[01-05]" /etc/hosts /etc
π ORIGIN π
Pdsh/pdcp was originally a rewrite of IBM dsh(1) by Jim Garlick <garlick@llnl.gov> on LLNL's ASCI Blue-Pacific IBM SP system. It is now also used on Linux clusters at LLNL. iconic origin story honestly π
π LIMITATIONS π
When using ssh for remote execution, stderr of ssh to be folded in with that of the remote command. When invoked by pdcp, it is not possible for ssh to prompt for confirmation if a host key changes, prompt for passwords if RSA keys are not configured properly, etc. π Finally, the connect timeout is only adjustable with ssh when the underlying ssh implementation supports it, and pdsh has been built to use the correct option.
π₯ SEE ALSO π₯
okay bestie that's the whole page π this one came out of the linux-gnu build, and it lives in the pdsh(1) manual β so like, go forth and copy files to a whole group of hosts at once. slay, ate, no crumbs. πβ¨π¦
π¦ where this page comes from
- epel 10: pdsh 2.36-3.el10_3 Β· GPL-2.0-or-later
- epel 9: pdsh 2.36-3.el9 Β· GPL-2.0-or-later
- fedora 44: pdsh 2.36-1.fc44 Β· GPL-2.0-or-later
- nixos 26.05: pdsh 2.36
- opensuse-leap 16.0: pdsh 2.35-bp160.1.3 Β· GPL-2.0-or-later
- opensuse-leap 16.0: pdsh 2.35-bp160.1.3 Β· GPL-2.0-or-later
- opensuse-leap 16.0: pdsh 2.35-bp160.1.3 Β· GPL-2.0-or-later
- opensuse-leap 16.0: pdsh 2.35-bp160.1.3 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms