Multi Gnome Terminal's Edit Commands function is a way to customize the creation of new terminals. Edit Commands is accessed from the Settings menu.
A "command" in this context can be any command recognized by the shell. Typically, this is used to start a new interactive shell (which in most cases would be bash). But actually any command may be run. When the command exits, so does the shell, and consequently so does the Tab (unless it was running a split terminal, in which case the split is removed). So, if simple "commands" are to be run (i.e. not an interactive shell), they should include some means to keep the shell from exiting, or else the output of the command will be lost when the terminal closes abrubtly. Example:
tail -f /var/log/messages |
tail -f does not exit immediately like just plain tail does (without the "-f"). See the tail man page for exactly what this does, and other options.
Alternately, the mgt-helper utility that is bundled with Multi Gnome Terminal can be used to execute more complex and interesting shell commands (and other uses too). For instance, "ps | less" does not work as a simple Command since it is difficult for Multi Gnome Terminal to know how to interpret all shell type conventions (such as "piping" and metacharacters). But the above example can be run easily with a little help from the mgt-helper shell utility, when run as: "mgt-helper -x ps | less", which essentially lets the shell handle all the parsing and subsequent execution of the results. Of course, you could always do your own scripts for such things; mgt-helper just provides a convenient way of doing more complex commands without having to write your own script.
There are three categories of "commands":
Common to all Classes: These will always appear on the New Term menu.
Class Dependent: These will will not show on the New Term menu, and are used to define "Start-up Tabs", and belong to a specific "Class" (see the Terminal Classes Section.). Different "Classes" can have their own unique start up "Commands" and Tabs.
Hardset Commands: These are the built-in commands that appear at the top of the New Term menu by default, such as mc and shell.
Each Command category can be configured in a corresponding Tab within the Edit Commands window.
At the top of the Window are four input fields: Name, Path, Command, and Tab Class. The "Name" is what will appear as the menu selection on the New Term menu. "Path" is optional, and Multi Gnome Terminal will change to this directory when executing the "command". "Command" is, of course, the command to execute. "Tab Class" is the Class that this Tab belongs to (optional as well).
After adding a new "Command" by filling in the appropriate input fields, click the Add button just below the input fields, then the Apply button near the bottom of the Window. Your command will now appear in the list, and also now on the New Term menu. Commands created this way are always available from the New Term menu (see "Startup Tabs" below for Tabs that are initialized only for specific Classes).
To create multi-level sub-menus, use a "/" character for each level. Example:
Projects/School/Science |
This would put a "Projects" item on the New Term menu, which would open a sub-menu with "School" on it, which, in turn, would open a third level sub-menu with "Science" on it. Now clicking on "Science" would initiate a new terminal, and the Tab will be titled "Science" (unless running in a split terminal). This is useful for grouping commands that are often used in conjunction with each other. Or to reduce clutter on the New Term menu.
The first word entered in the "Command" input field, is the command to be executed. Any other "words", or characters (separated by white space), will be passed to the "command" as arguments. So combining "commands" in one statement, will not work by itself (e.g. ls -l | less). Create a shell script to do this for you, then use the script name for the "command". (See examples in the Appendix.) Or use mgt-helper to circumvent such problems. See the mgt-helper Section for all various available options and features. |
If you want to start a new interactive shell (command line session), then for the "Command" input field, you should use the command name to invoke your preferred shell, with appropriate command line options. For most of us, this is bash. Example "command" entry:
This will open a new terminal, with a normal bash login shell running with our friendly Linux command line waiting for us. See the Appendix for more advanced examples. |
You can reposition Command entries by dragging them with the mouse so that they are ordered how you want them to appear on the New Term menu. Newly added entries will appear at the bottom of the list (unless moved by dragging). |
Any "Command" you define here, can also be accessed through Keybindings as well. See the Keybindings Section. |
Defining a Class Dependent command is much the same as above. The main difference is that these never appear on the New Term menu, and can be automatically initiated on program start-up.
Class Dependent Tabs can also be associated with different Win Classes, so that conceivably there can be many Win Classes, each with a unique start-up configuration. See the Window Class listbox in the lower righthand corner for selecting Win Classes (these must already exist).
Any commands in this Tab's list, will be executed on program start-up with the appropriate Win Class (or the Default Class if no Class is specified), thus creating the desired Tabs automatically, as long as the Don't open startup tabs checkbox at the very bottom of the Window is not checked.
You can either create new start-up "commands" through the same steps as outlined above (Add button, etc), or you can copy "commands" from the New Term Menu Tab with the Get button. Just highlight the "command" you want to copy with the mouse first, switch Tabs, then click on Get, and then Apply, of course.
In addition to specifying a Win Class that applies to the entire Window, you can also specify Tab Classes using the input field in the top righthand corner. Remember, a Tab Class only applies to that one Tab.
Start-up Commands do not appear on the New Term menu, but you can use the Get feature to have the same Command in both locations. |
This Tab contains configuration options for controlling which of the built-in, "hardset" entries appear on the New Term menu. These are the default selections that normally appear at the top of the menu (e.g. Shell and mc).
These can be individually disabled/enabled. There are six possible entries:
A normal, user, interactive bash shell is started.
A root shell is launced with su -.
The Midnight Commander, a text based file manager, is started.
The terminal is split with the new terminal being moved from another Tab or Window.
A terminal is opened in "view" mode, to view the activity in another terminal from another Tab, or another Window.
A new Tab is created by moving an existing split Tab from the current Window, or another terminal from another Window.
These are all explained in more detail in the Menu - New Term Section. Please refer to that.
You can also choose to disable all default selections with the hide all hardset items button.
To make any changes to an existing Multi Gnome Terminal Command, click on the Command with the mouse, and then click the appropriate button: Edit to modify this "Command", or Remove to delete this "Command". If editing, then once you've changed the input fields at the top, click the Update button. For both situations, click Apply to have your changes take effect. Or as our fearless leader calls it, the "make it so" button ;-)