5. Edit Commands

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 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. 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.

There are two categories of "commands": common to all Classes (these will appear on the New Term menu), and class dependent (used to initialize Tabs for a particular "Class").

 

The Edit Commands Window

5.1. Creating New Commands

To create a new Multi Gnome Terminal command, open the Settings menu, and click on the Edit Commands selection. A new Window will open. At the top are three input fields: Name, Path, and Command. 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.

After adding a new "Command", 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 upper of the two listboxes, and also now on the New Term menu. Commands created this way are always available, and not tied to a specific Gnome Terminal "Class" (see "Startup Tabs" below for "Class" dependent Tabs).

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 "School" would initiate a new terminal, and it will be titled "Science" (unless running in a split terminal). This is good for grouping commands that are often used in conjunction with each other. And to reduce clutter on the New Term menu.

Tip

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:

   /bin/bash --login

This will open a new Tab, with a bash login shell running. See the Appendix for more advanced examples.

Note

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 (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.)

5.2. Startup Tabs

You will notice there are two listboxes within the main Window. The upper one is for normal "commands" that will always appear on the New Term menu. The bottom one is used for defining "Startup Tabs" which will not show on the menu, and which belong to a "Class" (see the Terminal Classes Section.). Different "Classes" can have their own unique start up "Commands".

As long as the Don't open startup tabs checkbox at the very bottom of the Window is not checked, then any commands in the bottom listbox, will be executed on program start-up with the appropriate "Class" (or the Default Class if no Class is specified), thus creating the desired Tabs.

You can either create new startup "commands" through the same steps as outlined above, but using the second set of buttons (e.g. Add, etc), or you can copy "commands" from the upper listbox with the Get button. Just highlight the "command" you want to copy with the mouse first, then click on Get, and then Apply. Start-up "commands" will belong to whatever "Class" is currently active when they are created, unless you specify a different one using the selection options in the lower right hand corner.

Note

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.

5.3. Editing and Deleting Commands

To make any changes to an existing "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.