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

Oh s**T, I cannot boot Ubuntu – I’ve lost my gnome

The problem

I installed some software on Ubuntu, which I had not realised was very back level. It prompted and said

The following packages will be REMOVED:
fuse3 gnome-remote-desktop gnome-shell-extension-desktop-icons-ng gvfs-fuse nautilus
ntfs-3g shfs ubuntu-desktop-minimal ubuntu-session xdg-desktop-portal xdg-desktop-portal-gnome xdg-desktop-portal-gtk

Do you want to continue? [Y/n]

I blindly replied y – as I always do.
The next IPL failed to start, and left me in a command window with strange messages.

The cure

I rebooted, and selected a kernel with recovery mode.
This displayed a menu with

resume   Resume normal boot
...
network Enable networking
root Drop into root shell mode
...

I selected network. This gave a window with

Continuing will remount your / filesystem in read/write mode.  Do you wish to continue?

I clicked on <yes> .

Some status messages were displayed at the bottom of the screen, and it returned to the original menu.

At the menu I selected root. This gave me a command window with access to the network.

The magic command to restore Gnome was

sudo apt install gnome-desktop

This installed various packages.

I then issued

sudo shutdown now -r

and my Ubuntu came up as if nothing had happened.

Lessons learned

After I had recovered my Ubuntu, I remember doing this recovery before. Unfortunately I had written the recovery instructions in a file under my userid, but I could not find them during recovery. The wise thing to do is print off the instructions and keep a copy in my desk – or blog them as I’ve just done.

Upgrade to Ubuntu 24.04 – whoops I’ve lost my network connections

I used remote access to upgrade my Ubuntu server. After the upgrade I could not connect over Ethernet. ( I could not access over Wi-Fi, but that was a different problem).

If I pinged from either end, it did not connect.

On my server, the network server for the network connection wired, did not have a MAC address specified. I used the pull down and selected it. I do not know if this is relevant.

My laptop had address 10.1.0.2, and the server had address 10.10.0.3.

On the server the command

ip addr

gave

2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 ...
inet 10.1.0.3/24 brd 10.1.0.255 scope global noprefixroute eno1

I used the command

sudo ip route add 10.1.0.2 dev eno1

to define the route, and connectivity was temporarily restored. I could ping from either machine.

Digging deeper

The command

grep -i warn /var/log/syslog

gave

NetworkManager[1457]: <warn>  [...] keyfile: load: "/etc/NetworkManager/system-connections/eno1": failed to load connection: File permissions (100604) are insecure

ls -ltr /etc/NetworkManager/system-connections/eno1

gave

-rw----r-- 1 root root 376 Oct 21 2022 /etc/NetworkManager/system-connections/eno1

Where file permission xxx604 is -rw—-r–, which allows “other” to read the file

The command

sudo chmod o-r /etc/NetworkManager/system-connections/*

removes the “other” read permission.The next reboot gave me connectivity back.

Lessons learned

After doing an upgraded, (or perhaps once a week) display the syslog for warn and error and resolve any problems.

Ubuntu 24.04 upgrade. tp-link wifi did not work

I upgraded from 22.04 to 24.04 and my plug-in Wi-Fi tp-link device did not work.

What device do I have ?

The command

lsusb

gave me

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 17ef:4515 Lenovo Lenovo Portable HDD
Bus 001 Device 003: ID 2357:0109 TP-Link TL-WN823N v2/v3 [Realtek RTL8192EU]

but the command

sudo lshw -c network

did not show me any wireless definitions.

Fixing the problem

I followed the instructions in https://github.com/Mange/rtl8192eu-linux-driver.

The files you need may already be on your machine for earlier versions of Ubuntu, you may not need to download anything.

Because my server had no Wi-Fi connection, I used git to download the latest code to my laptop onto a USB device, and then used the USB device on the server machine. You may not need to do this.

I used the instructions to

  • sudo dkms uninstall rtl8192eu/1.0 to uninstall the driver and
  • sudo dkms remove rtl8192eu/1.0 –all to delete the drive
  • reboot
  • then followed the instructions.

Without the uninstall and remove the install did not activate the drivers.

Migrating from Ubuntu 22.04 to 24.04

Overall this was pretty painless, but did have a few problems on the way.

Could not contact web sites

I used the Software Updater application to upgrade to 24.04. This could not get to some sites. This is because some git hub keys had expired. (EXPKEYSIG 23F3D4EA75716059) See here for the solution.

  • Copy the long command to the clip board and execute it.
  • I do not think I needed to reinstall gh. ( I cannot test this because my migration was a success)

Disk space

The install complained that I did not have enough free space on /.

I removed various products: thunderbirds, libreoffice, gcc (theses get re-installed as part of the upgrade). I emptied the rubbish bin.

I removed some of the snaps.

The command snap list –all lists all of the currently installed snaps. The output is like

Name            Version       Rev Tracking      Publisher   Notes
gnome-3-38-2004 0+git.efb213a 143 latest/stable canonical** -
gnome-3-38-2004 0+git.6f39565 140 latest/stable canonical** disabled
...

My snap is configured to keep two revisions around.

I deleted the older versions

snap remove “gnome-3-38-2004″ –revision=”140”

I did not want to delete all versions, in case my upgrade to 24.04 failed, and I stayed on 22.04 for a while longer.

The upgrade took several hours,and seemed to work.

Rebooted into command line

After it had finished installing, I rebooted, and it booted into a command line – not the full screen mode.

I had been caught like this before, and used the command

sudo apt install –resinstall ubuntu-desktop

to reinstall gnome.

The next boot worked.

What’s different?

gedit

gedit is not installed by default. You can use apt to install it. The replacements is gnome-text-editor. I created an alias in ~/.bashrc

alias gte='gnome-text-editor'

so I can type gte…. to open a file.

parcellite did not work

I used this as my clip board manager. I started it, but it did nothing. A little while later it did work.

I installed copyq which provides more capability than parcellite.

I used settings -> Keyboard -> Keyboard Shortcuts > Custom shortcuts to create a short cut to copyq menu.

I used dash -> show apps -> startup applications to add copyq.

Touchpad speed

I still needed to use

echo 250 |sudo tee /sys/devices/platform/i8042/serio1/serio2/sensitivity

to make my touchpad sensitive to movement. You can also tweak/sys/devices/platform/i8042/serio1/serio2/speed.

I also found the command xset m 4/1 0 but I haven’t played with it

Why has it gone dark?

I use my laptop with a dual monitor, and the laptop was very dark (to the point of being almost unreadable). After a bit of faffing around the laptop brightness controls worked, and the screen came back to normal.

I also found

cat /sys/class/backlight/intel_backlight/brightness
cat /sys/class/backlight/intel_backlight/max_brightness

which gave me brightness 1365 and max_brightness 1515.

You can change the brightness using

echo 1000| sudo tee /sys/class/backlight/intel_backlight/brightness

This may be due to auto-dimming. Settings -> Power -> Power savings dim screen.

Lenovo server problems

When I ran sudo apt update, I got messages like

W: Skipping acquisition of configured file ‘sutton.simon/dep11/icons-64×64@2.tar’, as repository ‘http://lenovo.archive.canonical.com noble InRelease’ doesn’t have the component ‘sutton.simon’ (component misspelt in sources.list?)

I issued commands

  • sudo mv /etc/apt/sources.list.d/oem-sutton.simon-banning-meta.sources ~/sources.list.d.oem-sutton.simon-banning-meta.sources
  • sudo mv /etc/apt/sources.list.d/oem-sutton.simon-banning-meta.list.distUpgrade ~/sources.list.d.oem-sutton.simon-banning-meta.list.distUpgrade

and it seems to have cured the problem.