Marco Fioretti shows you how to create GNOME terminals that are customized to your needs and highly portable.
These days, in Linux, we must almost never access the raw command line -- a bare prompt in a text-only environment. We have terminal emulators; that is, special windows that host both the line(s) in which you type commands, and the hidden interpreter (shell) that actually executes them.
These emulators can be customized and preconfigured to speed up your work in several ways. Here I'll show you how to do it with the GNOME terminal, the default one in many Gnu/Linux distributions targeting novice users.
Some features of this terminal that make it a fast and very adaptable command line environment are well known to most users. The GNOME terminal has tabs, just like Firefox or any other modern browsers, to pack as many sessions you need in the smallest possible space. Other capabilities of GNOME terminal are less known, but equally useful. Here are the ones that make it possible to create your own terminals and have them always at hand.
Lots of command line options
The GNOME terminal executable, which not surprisingly is called gnome-terminal, has many command line options. To see all of them, go to a prompt and type gnome-terminal --help-all. Here I'll only mention the ones that activate some of the features presented in the following paragraphs.
Viewing more, more clearly
You can increase the "space" in a GNOME terminal; that is, the amount of text visible at the same time, in several ways. One is to go full screen by pressing F11. A more flexible solution is to zoom in or out through the corresponding voices in the View menu or pressing CTRL+ and CTRL-. The same menu offers another option to see a bit more text: you can hide the menu bar by un-ticking the corresponding entry. To bring it back, click with the right mouse button anywhere in the terminal and activate Show Menubar in the popup menu. Selecting Leave Full Screen in the same place will restore the terminal window to its previous size. You can also set the full screen mode and zoom factor with the command line options --full-screen and --zoom=X (X equal to 1 is the normal size).
Setting the initial commandIf there are any command line programs that you always run in every session, there is no need to actually type their name when you start a terminal for them. You can set GNOME terminal in such a way that it will immediately start the application you want when you invoke it in the right way. To do this, select Edit | Profile Preferences (I'll explain what profiles are in a moment), switch to the Title and Command tab of the configuration window and select "Run a custom command instead of my shell". Next (see Figure A), type the command you want to start and decide what you want GNOME terminal to do when it exits. The equivalent command line option is -r or --command.
Please note that, depending on how the rest of your desktop is set up, some configuration variables normally used by your "custom command" may be undefined when you start it in that way.
ProfilesA group of terminal settings that are always applied together constitutes a GNOME terminal profile. You can see the existing profiles by selecting Edit | Profiles in the menu bar of an open terminal, and modify them choosing Edit | Profile Preferences. Each tab of the same GNOME terminal window can have a different profile. This is very useful to never forget where you are and what you're supposed to be doing. For example, I have three profiles, each with a different combination of background and text colors for:
- normal work in my home directory
- working as root on my home computer
- the ssh session to my Web server
In this way, it is impossible to forget which account I'm using and where. You can create as many profiles you want (Edit | Profiles or File | New profile). When you do that, you can also save time by importing the settings of an existing profile and changing only what needs changing. Just remember to give each profile a unique name. Starting a terminal with a non-default profile will then be possible with the --profile=PROFILE-NAME option.
Starting the same custom terminals, on any Linux distribution
You can save and quickly launch how many custom terminals you want, each with its unique configuration and combination of tabs, in two ways. The simplest is to create aliases with the right command line options, for example, gnome_mutt for "gnome-terminal --command "mutt -F /home/marco/.mutt/muttrc". This method, however, is only practical when you need just a few options.The other, much more flexible approach makes it possible to start with one simple command GNOME terminals with many tabs, each one with its own different profile. First, open a new terminal and create that combination of tabs, each with its own profile, setting any parameter just the way you need it. Then, from any of those tabs, type "gnome-terminal --save-config=MY_TERMINAL". This will save all the settings of the current session in a plain text file named MY_TERMINAL, with this kind of format (this is just a sample excerpt):
[GNOME Terminal Configuration]
See what I meant by "all the settings"? Even things like the windows size, position, zoom level and working directory in each tab are saved. At that point, an alias like "gnome-terminal --load-config=MY_TERMINAL" will open a perfect replica of the terminal you had saved. What's great with this method is that it is also very portable. That alias will work in the same way on each version of Linux and other Unixes that support the same version of the GNOME terminal. Just remember to include the configuration file in your regular backup list!