How do I mange my gnome terminals in Ubuntu?

I’ve been struggling with using so many terminal windows in Ubuntu.

I’ve got a group of command windows for running monitoring tools; opentelemetry, prometheus, grafana, Jaeger. I have a group using SSH to work with z/OS, and a some for looking at output files (using less).

I’m running more than 10 gnome windows, and it was difficult knowing which was which, because they all had a title of colin@ColinNew, and all looked similar

I can use alt-tab to switch from my 3270 sessions to the terminals, then use ctrl+page down to move between terminal windows.

I had one terminal window, with all of the terminals defined within in it, but there was a lot of tab, tab, tab, until I got to the right window. It may have been quicker to use back tab – but I could not easily tell this.

I can change the colour of the window

This made it easier to know when I got to the correct window. Green background was prometheus. Yellow background was Jaeger etc.

  • Hamburger -> Preferences, then define a profile
  • Select a window. Hamburger – > profile, and select a profile

Change the label of the terminal window

The article Changing the Title of the Current Terminal Tab in Linux CLI was very useful.

In my window run PS1='[\e]0;Prometheus\a]\u@\h\w\$ ‘

Where

[\e]0;\u@\h: \w\a] sets the title bar of an xterm window:

  • [ starts a section of non-printable characters
  • \e]0; is the escape sequence for ‘set xterm title’
  • \u@\h: \w the title to use (see below for \u, \h and \w)
  • \a marks the end of the title
  • ] marks the end of non-printable characters
  • ${debian_chroot:+($debian_chroot)} expands to the value of $debian_chroot in parentheses if $debian_chroot is set. See this question for more information about $debian_chroot.

\u@\h:\w\$ is the prompt itself:

  • \u expands to the current username
  • \h expands to the current hostname
  • \w expands to the current working directory
  • \$ expands to # for root and $ for all other users

I set up a script with the PS1 definition. To run it, and define the title for the window, I had to use

source oo.sh

If you use bash oo.sh or sh oo.sh the command do not apply to the first window. Source runs the oo.sh command as if you had typed them all into the window.

Move the terminals within the windows

I tried starting the windows in the same order, so the terminals were in the same position in the window. You can move the terminals, but right click the title and chose move right or move left.

Use more than one workspace

Create more than one work space, set a different background, so I know if I’m in “monitoring tools” mode, or z/OS mode.

Use Windows key + pg up/down to move work spaces.

I organised my windows

  • the “monitoring” terminals on the monitoring workspace,
  • and the other terminals on the other work space. with a dark background.

I now have two sets of work spaces, one with 6 monitoring, and one with z/OS and other terminals

So overall I now do fewer keystrokes to get to the window of interest.

I’m sure there are other ways of speeding up access to my windows.

How do I move a window to a different workspace?

Make the window active, then Windows key, shift and down key – and you will see the background behind move as you go to a different workspace

Which terminal am I in?

I use Ubuntu as my main work station, and found I was getting confused with so many terminals windows open. I found the following helped me manage it.

From a terminal Ctrl-Alt-T gives you a new tab with a new terminal.

I can quickly move between them using Ctrl-PgDn and Ctrl-Pg-Up – just like in a browser.

I can rearrange them using Ctrl-Alt-PgDN and Ctrl-Alt-PgUp, so my commonly used tabs are adjacent.

I can colour the terminal sessions. Select a terminal, right click, preferences. You can now create more profiles, such as “Blue” or “QMPROD” and select the colour of the font and background. I can then, from my terminal, right click, profiles, and select “Blue”. As long as I remember what I use each colour for – it is a great help.