gsh (1) - Linux Manuals

gsh: Group Shell


gsh - Group Shell


gsh [OPTIONS]... HOSTS...


gsh spawns many remote shells at once and allows to manage them in a single interface.


The gsh prompt shows either 'ready (X)> ' or 'waiting (X/Y)> '. The 'ready' prompt means that all enabled remote shells are ready to receive commands and there are X such remote shells. Failing that, the 'waiting' prompt is shown, meaning that X remote shells are not yet ready to receive commands. Either way, all the readline editing features like navigation in the history, searching in the history, and completion are available.

Commands prefixed by an exclamation mark are executed locally.

Signals like Ctrl-C and Ctrl-Z sent to gsh are forwarded to the remote shells.


The gsh prompt supports completion by pressing the Tab key. Completion results are taken from the command line history, paths from the local filesystem and commands from the user $PATH.


Host names with numbers can be generated by gsh using the <START-END> syntax. The generated numbers will be zero padded according to the number of zeroes in the START and END numbers.


Show program's version number and exit.
-h, --help
Show the help message and exit.
Read hostnames from given file, one per line. Hostnames are given on the command line, but they can also be read from files. The format is one hostname per line, '#' comments and blank lines are skipped.
Command to execute on the remote shells. This starts gsh in non-interactive mode. It will start the remote shells, send the command, print the output and exit when the command is completed on all remote shells. This is the same as piping a command on the standard input.
Ssh command to use [ssh -t %(host)s bash --noprofile]. By default, gsh spawns lightweight remote shells using the ssh command, but another shell command can be specified here. For example, with --ssh='usleep $((RANDOM*50)); exec ssh' a delay will be introduced to avoid all hosts accessing a NFS server at the same time. If the hostname should not be added at the end of the command, the macro %(host)s can be inserted where the hostname should be placed. Also, make sure the command you use launchs a pty, this may need the -t option for ssh.
File to log each machine conversation [none]. If specified, gsh will log all executed commands and their output in the file. The logging destination can be dynamically changed with the :set_log control command.
Abort if some shell fails to initialize [ignore]. By default, gsh just logs an error when it cannot succesfully open a remote shell. With this option, it exits with a failure.
Print debugging information. Use this option to see exactly what is transferred between gsh and the remote shells. This option can be dynamically toggled using the set_debug command in the control shell.


Control commands are special purpose commands prefixed by a colon and directed at gsh itself instead of the remote shells. These commands are:
:add NAMES...
Add one or many remote shells.
Change the current directory of gsh (not the remote shells).
:disable [SHELLS...]
Disable sending commands to remote shells. The special characters * ? and [] work as expected.
:enable [SHELLS...]
Enable sending commands to remote shells. The special characters * ? and [] work as expected.
Set GSH_RANK and GSH_NR_SHELLS on enabled remote shells. The GSH_RANK shell variable uniquely identifies each shell with a number between 0 and GSH_NR_SHELLS - 1. GSH_NR_SHELLS is the total number of enabled shells.
:help [COMMAND]
List control commands or show their documentations.
Do not echo the next typed line. This is useful when entering password. If debugging or logging is enabled, it will be disabled to avoid displaying a password. Therefore, you will have to reenable logging or debugging afterwards if need be.
:list [SHELLS...]
List remote shells and their states. The output consists of: <hostname> <enabled?> <state>: <last printed line>. The special characters * ? and [] work as expected.
:purge [SHELLS...]
Delete disabled remote shells. This helps to have a shorter list. The special characters * ? and [] work as expected.
Quit gsh.
:reconnect [SHELLS...]
Try to reconnect to disconnected remote shells. The special characters * ? and [] work as expected.
:rename [NEW_NAME]
Rename all enabled remote shells with the argument. The argument will be shell expanded on the remote processes. With no argument, the original hostname will be restored as the displayed name.
Copy a path from one remote shell to all others
:reset_prompt [SHELLS...]
Change the prompt to be recognized by gsh. The special characters * ? and [] work as expected.
:send_ctrl LETTER [SHELLS...]
Send a control character to remote shells. The first argument is the control character to send like c, d or z. Note that these three control characters can be sent simply by typing them into gsh. The remaining optional arguments are the destination shells. The special characters * ? and [] work as expected.
:set_debug y|n [SHELLS...]
Enable or disable debugging output for remote shells. The first argument is 'y' to enable the debugging output, 'n' to disable it. The remaining optional arguments are the selected shells. The special characters * ? and [] work as expected.
:set_log [LOCAL_PATH]
Duplicate every console I/O into the given local file. If LOCAL_PATH is not given, restore the default behaviour of not logging.
:show_read_buffer [SHELLS...]
Print the data read by remote shells. The special characters * ? and [] work as expected.
:upload LOCAL_PATH
Upload the specified local path to enabled remote shells.


Guillaume Chazarain <guichaz [at]>