dsh(1)

πŸ’– dsh(1) β€” the Dancer Tools reference, but make it a group chat πŸ’–

okay bestie, sit down, hydrate, because we're about to talk about dsh(1). yes, the 1 means it's a user command, and yes, that's the whole manual page name, iykyk. πŸ¦‹


✨ NAME ✨

dsh β€” Distributed shell, or dancer's shell. two names, both iconic, no notes. πŸ‘‘


✨ SYNOPSIS ✨

dsh [-m machinename | -a | -g groupname] [-r remoteshellname] [-c | -w |
-i | -F forklimit ] -- commandline

look at her. she's got options and she's not afraid to use them. πŸ’…


✨ DESCRIPTION ✨

so like. dsh executes command remotely on several different machines at the same time. literally the whole point. it's a utility to effectively do this little bourne shell vibe:

for a in $(seq 1 10); do rsh $a command; done

...except you don't have to write that loop yourself, because you're a main character and main characters delegate. 🌈


✨ OPTIONS ✨

here's the whole lineup, no skips, no skimming, we respect every flag in this house. 🫢

  • --verbose, -v β€” gives you verbose output of the execution process. she's chatty. we love that for her.
  • --quiet, -q β€” makes output quieter. shhh. 🀫
  • --machine, -m [machinename[,machinename]] β€” adds *machinename to the list of machines that the command is executed on. the syntax of machinename allows username@machinename, where the remote shell is invoked with the option to make it of username. and from version 0.21.4, you can specify it in the format username@machinename,username@machinename,username@machinename so that multiple hosts can be specified with comma-delimited values. comma-delimited!! multi-host!! we ate. πŸ”₯
  • --all, -a β€” adds all machines found in /etc/dsh/machines.list to the list of machines that the specified command is executed on. all of them. the whole squad. πŸ‘―
  • --group groupname, -g groupname β€” adds all machines found in /etc/dsh/group/groupname to the list of machines that the specified command is executed on.
    • if groupname is on the form @netgroup then the machines in the given netgroup are used to specify the list of machines to execute on. netgroup girls, rise. 🧚
  • --file machinefile, -f machinefile β€” adds all machines found in the specified file to the list of machines that the specified command is executed on.
    • the file should list one machine specification per line (with the same syntax as the machinename argument). lines starting with "#" are ignored. thank u for the comments, king. πŸ™ˆ
    • from version 0.21.4, specifying the same machine several times using any of the machine specification options will result in multiple invocations merged into one. so you can't double-dip, the machine gets counted once, periodt.
  • --remoteshell shellname, -r shellname β€” executes remote shell shellname as the remote shell. usually any of "rsh", "remsh" or "ssh" are available.
  • --remoteshellopt rshoption, -o rshoption β€” adds one option rshoption to the list of options passed on to the remote shell. one at a time, bestie, stack 'em up.
  • --help, -h β€” outputs the help message and exits. classic.
  • --wait-shell, -w β€” executes on each machine and waits for the execution to finish before moving on to the next machine. patient. polite. a gentlewoman. πŸŽ€
  • --concurrent-shell, -c β€” executes shell concurrently. everyone at once, chaos mode, love that.
  • --show-machine-names, -M β€” prepends machine names on the standard output. useful to be used in conjunction with the --concurrent-shell option so that the output is slightly more parsable. slightly. we take what we can get. ⭐
  • --hide-machine-names, -H β€” do NOT prepend machine names on the standard output. the opposite girl.
  • --duplicate-input, -i β€” duplicates the input to the dsh process to individual processes that are remotely invoked. needs to have --concurrent-shell set. ⚠️
    • due to limitations in the current implementation, it is only useful for running shell. terminate the shell session with ctrl-D.
  • --bufsize, -b [buffer-size in bytes] β€” sets the buffer size used in replicating input for the --duplicate-input option.
  • --version, -V β€” outputs version information and exits.
  • --num-topology, -N β€” changes the current topology from 1. 1 is the default behavior of spawning the shell from one node to every node. changing the number to a value greater than 2 would result in dsh being spawned on other machines as well. πŸ•ΈοΈ
  • --forklimit, -F fork limit β€” similar to -c with a limit on the number of simultaneous connections. dsh will wait before creating a new connection if the limit is reached. useful when the number of nodes to be accessed is going somewhere above 200, and using the -N option is not possible. πŸ’€ (200 nodes?? bestie what are you doing)

✨ EXIT STATUS ✨

  • the first non-zero exit code of child processes is returned, or zero if none returned a non-zero exit code.
  • 1 if an error is found in command-line specifications.
  • 2 if a signal is received from child processes.

so if something goes sideways, you'll know exactly which flavor of sideways. 🌸


✨ EXAMPLES ✨

these are the vibes, copy them, they're free:

dsh -a w

shows the list of users logged in on all workstations.

dsh -r ssh -a -- w

shows the list of users logged in on all workstations, and uses the ssh command to connect. (it should be of note that when using ssh, ssh-agent is handy.) πŸ’…

dsh -r ssh -m node1 -m node2 -c -- 'echo $HOSTNAME $(cat/proc/loadavg )'

shows the load average of machines node1 and node2.


✨ FILES ✨

  • /etc/dsh/machines.list | $(HOME)/.dsh/machines.list β€” list of machine names to be used for when the -a command-line option is specified.
  • /etc/dsh/group/groupname | $(HOME)/.dsh/group/groupname β€” list of machine names to be used for when the -g groupname command-line option is specified.
  • /etc/dsh/dsh.conf | $(HOME)/.dsh/dsh.conf β€” configuration file containing the day-to-day default. the daily driver. πŸš—

✨ BUGS ✨

  • there should be a dcp for copying files to remote systems. (manifesting this for us fr fr πŸ™)
  • configuration files should really be able to do something more than they do now. we're all waiting. 😭

✨ AUTHOR ✨

Junichi Uekawa (dancer@debian.org)

upstream page is available at http://www.netfort.gr.jp/~dancer/software/dsh.html β€” go say hi to the upstream, she's iconic. πŸ‘‘


✨ SEE ALSO ✨

rsh(1), ssh(1), remsh(1), dsh.conf(5), cssh(1), dish(1), pssh(1), taktuk(1)

the whole friend group. go read them, they're all valid. πŸ¦‹


okay that's the whole page, you now know dsh better than most people know themselves. this came to you from the Debian-Beowulf/Dancer era, dated 2007 Aug 15, which honestly is giving vintage-but-still-slaying. go forth and distribute that shell, bestie. πŸ’–βœ¨πŸŽ€