---
name: "mgt-helper"
section: "1"
platform: "linux"
package: "multi-gnome-terminal"
version: "1.6.2-13"
release: "Debian 4.0 (Etch)"
platforms: ["linux"]
url: "https://new.carta.tech/mgt-helper"
---

# mgt-helper(1)

Shell extender program for Multi Gnome Terminal.

## NAME

mgt-helper - Shell extender program for Multi Gnome Terminal.

## SYNOPSIS

**mgt-helper** \[**-D,-r** *RC\_FILE***,-T,-H,-V,-W,-WT,-A** *URL\_ACTION*\]  \[**--usage, --help**\]  \[**-h, --history** *EXTENSION*\]  \[**-u, --url-handler, --http-handler**\]  \[**-f, --ftp-handler**\]  \[**-m, --mailto-handler**\]  \[**-F, --file-handler**\]  \[**-x, --execute** *COMMAND \[,COMMAND...\]*\]  \[**-U, --user-guide**\]  \[**-s, --ssh** *COMMAND*\]  \[**-S, --su**\]  \[**-g, --google**\]  \[**-lg, --lin-google**\]  \[**-l, --lookup** *\[WORD\]*\]  \[**-d, --debug** *COMMAND*\]

## DESCRIPTION

*mgt-helper* is a Bash script meant to be used in conjunction with *multi-gnome-terminal* to extend *multi-gnome-terminal's* usefulness in a shell environment.

The script contains a number subroutines that can be invoked from within  *multi-gnome-terminal's* "Edit Commands" or "Keybindings" features.  These subroutines are essentially independent of each other, and are not  intended to be used in conjunction with each other.

Some of these subroutines are provided as a unique way of accomplishing some  task that would be difficult to do otherwise. While others are provided merely  as a convenience to show off an interesting idea or feature.

## GENERAL OPTIONS

These options must come first on the command line. More than one of these  may be used at a time, and can be combined with the COMMAND OPTIONS listed  below.

- **-D**

  Turn on verbose mode, which writes some debugging type info to screen  and to */tmp/mgt-helper.debug*.

- **-r *RC\_FILE***

  Parse *RC\_FILE* after other config files have been parsed, and  over-ride any previously defined values.

- **-T**

  Force a full Tab (useful if the default config uses a split).

- **-H**

  Force a horizontally split Tab.

- **-V**

  Force a vertically split Tab.

- **-W**

  Force a "New Window" instead of Tab or split.

- **-WT**

  Force a "New Window" with start-up Tabs for the current Class instead of Tab or split.

- **-A *URL\_ACTION***

  Force *URL\_ACTION* as the action that *multi-gnome-terminal* will  take to perform this command: e.g. **--add-tab**. Actions may be combined  within reason: e.g. **--add-tab --tclass myclass**. Do not use the  **-x** option, since this will be invoked by one of the COMMAND OPTIONS listed below. Quote to protect any white space.

## COMMAND OPTIONS

Use only one of these at a time.

- **--usage, --help**

  Show all command line options with brief explanation, and then exit.

- **-h, --history *EXTENSION***

  Force a user defined, custom Bash history file for this terminal's shell, where *EXTENSION* is a user-defined, unique string. This probably only works with bash right now. Use with "Edit Commands".

- **-u, --url-handler, --http-handler**

  For use as the GNOME HTTP URL/Document Handler. This will need to be set up in GNOME and will open a new Tab with a text browser. Example from *~/.gnome/Gnome*: http-show=mgt-helper -u "%s". All URL Handlers only work on Linux at this time.

- **-f, --ftp-handler**

  For use as the GNOME FTP URL/Document Handler. This will need to be set up in GNOME and will open a new Tab with a FTP client . Example from *~/.gnome/Gnome*: http-show=mgt-helper -f "%s".

- **-m, --mailto-handler**

  For use as the GNOME mailto URL/Document Handler. This will need to be set up in GNOME and will open a new Tab with a email client (MUA). Example from *~/.gnome/Gnome*: http-show=mgt-helper -m "%s".

- **-F, --file-handler**

  For use as the GNOME File URL/Document Handler. This will need to be set up in GNOME and will open a new Tab with a file manager or other pertinent information. Example from *~/.gnome/Gnome*: http-show=mgt-helper -F "%s".

- **-x, --execute *COMMAND \[,COMMAND...\]***

  Have the shell execute the command(s), rather than *multi-gnome-terminal*. This allows for much more complex commands to be run from Edit Commands.  See EXAMPLES section below.

- **-U, --user-guide**

  Open the User's Guide in a text browser. Use with Edit Commands, or can  be run direct from a shell prompt.

- **-s, --ssh *\[ssh args\] HOST \[command\]***

  Use *mgt-helper* as a ssh wrapper. This is probably only useful where the sshd daemon may be running as another user, and thus breaks our GNOME URL Handling tricks. Use with Edit Commands, if needed (ie if URL Handlers don't work properly).

- **-S, --su**

  Use *mgt-helper* as a su wrapper. Su'ing can break URL Handling. Use with Edit Commands, if needed (ie if URL Handlers don't work properly).

- **-g, --google**

  Search google.com/linux. Provided as a convenience feature only. Use with Edit Commands.

- **-lg, --lin-google**

  Search google. Provided as a convenience feature only. Use with Edit Commands.

- **-l, --lookup *\[WORD\]***

  Look up a word in an on-line dictionary. This will use the 'dict' command if  availalbe, otherwise the Merriam Webster on-line dictionary is used. Provided as a convenience feature only. If *WORD* is omitted, then user is prompted for word to look up.

- **-d, --debug *CMD\_TO\_DEBUG \[args\]***

  A troubleshooting aid to capture error output from shell commands (NOT MGT internals) that might vanish quickly otherwise. Any command that fails due to an error, or does not provide a means of preventing immediate exit of the spawned shell, will cause the terminal or Tab to close quickly, and the error message (if any) is thus lost. This is useful for trapping those situations. Use with Edit Commands.

- **--showall**

  This just dumps all variables from the bash environment to STDOUT, and also  writes the same to */tmp/mgt-helper.debug* as a troubleshooting aid.

## CONFIGURATION

There are a number of variables that can be defined to alter *mgt-helper's* behavior and set preferences. These are all listed in the script itself, though some may be commented out.

It is highly recommended that such user or site preferences be put  in another file. This can be */etc/mgt-helper.rc* for site-wide preferences, or *$HOME/.mgt-helper.rc* for individual user preferences. Both of these files are checked by *mgt-helper* automatically, with  the latter taking precedence.

In addition, since these configuration files will be sourced by Bash, any other variables or manipulation of the Bash environment, can be added at your discretion. For instance, you could set Bash's TMOUT variable, and even base this action conditionally on other environment factors, or the contents of the command line. Or you could check the command line contents, see if a url handler is being invoked, then check the URL itself, and alter the default handler dynamically based on certain conditions. For instance, use Mozilla for https sites, and w3m for http sites. Many possibilities.

## GNOME DOCUMENT (URL) HANDLERS

This feature is provided so that text based applications may be used with  *multi-gnome-terminal*. Presumably so that such documents can be opened  in a split terminal or Tab.

This is basically a feature of GNOME that allows user defined applications for different "document" types. *multi-gnome-terminal* has extended this  feature considerably, making it more useful. Typically, these apps are intended to be GUI apps like Nautilus. To change this behavior, you will first have to set *mgt-helper* with the appropriate command line option (e.g. -u) as the Handler for GNOME. This can be done through the GNOME menu interface, or by directly editing *$HOME/.gnome/Gnome* with a text editor (carefully!). Secondly, be aware now that any GNOME application that may access this feature, will be using *mgt-helper* as the application of choice, even if it is some other application altogether (which won't work at all). This means that there must be alternate handlers set up for such situtations, preferably in either *$HOME/.mgt-helper.rc* or */etc/mgt-helper.rc*. Defaults are provided, but probably won't work on some systems. See the script for appropriate variable names.

## ENVIRONMENT

Since *mgt-helper* is Bash script, it is influenced by, and can be manipulated with, any of the various Bash variables, commands and expressions.

## EXAMPLES

The following examples are what go in the "Command" field of "Edit Commands".

Create a custom Bash history file for this terminal:

```
   mgt-helper -h my_project
```

This will create and use a file named $HOME/.bash\_histroy-my\_project any time  this terminal or Tab is opened.

Using *mgt-helper* as a ssh wrapper for URL handling:

```
   mgt-helper -s some_host
```

Executing complex shell commands from "Edit Commands":

```
   mgt-helper -x export TMOUT=300 ; bash --login
```

```
   mgt-helper -x ps aux | less
```

```
   mgt-helper -x netstat -taun | less
```

## FILES

```
 /usr/bin/mgt-helper
 $HOME/.mgt-helper.rc
 /usr/bin/multi-gnome-terminal
 /usr/sbin/mgt-pty-helper
```

## BUGS

Not well tested, so probably yes, maybe numerous.

Not tested with any shells other than Bash, and most commands probably  only work with Bash.

Some commands will only work on Linux at this time. Notably, any of the URL Handling stuff.

## AUTHORS

Cristiano De Michele is the creator and author of *multi-gnome-terminal*. *mgt-helper* was written by Hal Burgiss and Cristiano De Michele.

## SEE ALSO

[multi-gnome-terminal(1)](/multi-gnome-terminal/1.md), [bash(1)](/bash/1.md)

See the **User's Guide** for a complete explanation of Multi-Gnome-Terminal's features and usage, and a more complete explanation of *mgt-helper's* features.

## BUGS AND FEATURE REQUESTS

Please use the tracking system at http://multignometerm.sourceforge.net to report bugs, request features, etc.

Bug Reports: \
  http://sourceforge.net/tracker/?atid=411232&group\_id=34480&func=browse

Feature Requests: \
  http://sourceforge.net/tracker/?atid=411235&group\_id=34480&func=browse

Patches: \
  http://sourceforge.net/tracker/?atid=411234&group\_id=34480&func=browse

Mailing Lists: \
  http://sourceforge.net/mail/?group\_id=34480

## COPYRIGHT AND LICENSE

Copyright (C) 2001, 2002 Cristiano De Michele and Hal Burgiss

*mgt-helper* is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details, which is available from the Free Software Foundation, Inc, 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
