Brian Keck > xchar > xterms


Annotate this POD

View/Report Bugs


xterms - run multiple xterms and remote logins


 xterms [-host host] [-name name] \
      [-rsh] [-rlogin] [-telnet] [-TELNET] [-ssh] [-height height] \
      [-display display] [-fn font] [-u|-U] [-C] [-sleep] \
      [-c config] \
      where_and_what where_and_what ...


Does one of (first is default) ...

 * runs local xterms at specified places on the display,
   & logs into the specified host (usually) in all of
   them via ssh (default) or telnet or TELNET or rsh

 * runs remote xterms via ssh to the specified host (usually)
   at specified places on the display (remember .rhosts &

It can also be used simply to start some xterms.

All the arguments in the 3rd row above are passed to the xterms.

A where_and_what argument specifies (indirectly) the geometry of the xterms and (optionally) some environment for the xterms.

Much of the behaviour of xterms is controlled by the config file $HOME/.xterms, or as specified with -c

Finally $HOME/.screens is used, via the Perl module, which has its own documentation.

The (xterms) config file is a perl fragment returning a reference to a hash (associative array). Most keys are hostnames, but the empty key ('') and the key containing just an underscore have special meanings. The empty key means the default host.


For hostname & empty keys, the value is again a reference to a hash with either hostname or empty keys. The outer hostname is the name of the local host (where xterms is run), and the inner hostname the name of the remote host (as specified in the -host parameter or the name used to run $cmd). The inner values are hashrefs specifying properties of the login specific to the particular local & remotes hosts. The keys recognized are:

 address  IP address, in case the remote host has no name
 between  log into this host instead
 font     used for xterm argument
 height   xterm height (see below)
 name     xterm instance name (see below)
 noxenv   XENVIRONMENT not set for xterm
 port     instead of normal telnet port
 rcmd     telnet or TELNET or rlogin or rsh or ssh (default)
 user     remote user name, if different to local

The point of 'between' is that you may only be able to reach the desired host from an intermediate host.

Several of these correspond to command line arguments.

See below for how empty hostnames are handled.


In the simplest cases the where_and_what argument only specifies where. It is, or expands to, a string of characters each of which specifies an xterm geometry via $HOME/.screens (above).

For example, the command

        xterms a-d

starts 4 xterms, with the geometry specified for the keys a, b, c, d in $HOME/.screens.

The window height can be overridden by -height or a height attribute in the config file.

If where_and_what consists solely of dashes (-) then one xterm is created for each dash, with unspecified geometry. For no good reason, this is hardwired into xterms (maybe could have been left to $HOME/.screens).


The underscore key in the config file allows for more information being provided by where_and_what arguments.

Here is an example:

        xterms aar bbx cci

will start 6 xterms, 2 with geometry a, 2 with geometry b, & 2 with geometry c. The first 2 will have the environment variable CLASS set to readme, and the arguments '-name --classes--'. The second 2 are similar. The 3rd 2 will have the environment variable INBOXES set to c (from %p, p for place), & the arguments '-name ---inboxes---'.

The '+' in the example is treated as a separator, the where_and_what argument being split into 2 words. The 1st word is handled as above, and the second is set as the value of the environment variable ABB.

The command

        xterms ar+www

will start an xterm with geometry a, with CLASS set to readme and the environment variable ABB set to www (from %w, w for word).


The application name (xterm -name) (which is used for example by twm for icon manager names) is generated by padding out a base name to $maxname characters with dashes before & after. The base name is decided rather historically as follows. For xterms associated with an environment setting character, the base name is the name (not value) of the environment variable. If -name is used, then all other base names have the name thus specified. If not, then the remote host name is used, failing which 'xterm'.

The iconname is explicitly set to the -name value, lacking which to the remote host name, if any. The shell can override this by sending xterm control sequences, so this is most useful when the remote host is a router. If there is no -name or remote host, then nothing is done, leaving it to xterm, which sets it to 'telnet' or such.


The default DISPLAY is taken from the environment, or :0.0, or xxx:0.0 where xxx is the local host name, etc. Normally passed to remote host, but not with -D.


If no host is specified then no rlogin or such is done. The current directory is changed to $HOME before the xterms are started.

If the command is called by a name different to xterms then it's taken to be the host name (cf Note below).

An exception to the above is that if the entry in the config file has a 'between' key, whose argument is a host name, then the rlogin etc is done to that host instead. This is normally used when the final target host is only reachable from an intermediate (the 'between' value). The rlogin or such from the intermediate host to the final host is not done by xterms.


The host argument can have the form user@host. The remote user name can also be set in the config file.


The font is passed as the parameter of xterm's -fn flag. It can be set in the config file (see above) or on the command line.

The defaults are:


The latter (unicode) is used with -U or if specified in $HOME/.xscreens (via X11::Screen). In this case, -u8 is passed to xterm. With -u a smaller unicode font is used, but it's hard to read.

With -b (big font), defaults are:



With for example -2 there's a pause of 2 seconds between starting each xterm. The reason for this is that they are started in background, & on a slow machine the window manager can occasionally learn of them out of order, which may be undesirable.


All the options can be abbreviated to one letter, or 2 for -rlogin & -remote.


The config file can specify some defaults (rlogin/telnet/TELNET/ssh, name, font) through empty keys ('') in place of hostnames, as for example in ...

      { ...
        local1 => {
          remote1 => { ... },
          remote2 => { ... },
          '' => { ... }
        local2 => {
          remote1 => { ... },
          remote3 => { ... },
          '' => { ... }
        '' => {
          remote2 => { ... },
          remote3 => { ... },
          '' => { ... }

Here local1, remote1, etc are hostnames, & the { ... } contain attribute definitions.

The order of preference for taking attribute values from the config file is:

  (1) both local & remote hostnames nonempty
  (2) remote hostname nonempty, local hostname empty
  (3) local hostname nonempty, remote hostname empty
  (4) both local & remote hostname empty

That is, for a given local & remote host & given attribute, the value used will be from an entry of type (1) if given there, otherwise from an entry of type (2), etc.


 { '_' => {
     chars => {
       r => { var => 'CLASS', val => 'readme', man => 'classes', },
       x => { var => 'CLASS', val => 'x', man => 'classes', },
       s => { var => 'CLASS', val => 'script', man => 'classes', },
       h => { var => 'CLASS', val => 'html', man => 'classes', },
       o => { var => 'CLASS', val => 'odd', man => 'classes', },
       i => { var => 'INBOXES', val => '%p', man => 'inboxes', },
     words => {
       '+' => { var => 'ABB', val => '%w', },
   ram => {
     pollux => { rcmd => 'rsh', },
     '' => { rcmd => 'telnet', },
   '' => {
     lonsdale => { address => '', rcmd => 'ssh', },
     isp1 => { between => 'evunka', rcmd = 'rlogin', },
     ermintrude => { user => 'keck', },


The xterms are put in background so xterms & any ssh's don't wait.

The config file name is always the same, regardless of renaming or symlinking.


 xterms -l

Outputs (lists) the config file via $PAGER or more.

 xterms -show ...

Just outputs the commands that would be run. Still uses X11::Screen, so DISPLAY or -display needs to be correct.


Brian Keck <>


 $Source: /home/keck/gen/RCS/xterms,v $
 $Revision: 8.11 $
 $Date: 2007/07/05 17:00:30 $
 xchar 0.2
syntax highlighting: