I finally resolved a mystery on my main Ubuntu GNU/Linux system. Apparently randomly, my terminal would appear to lock up. Except I could open a new tab, and that terminal worked just fine.
tl;dr – I was accidentally putting the terminal into Read-Only mode. See further down below for the quick solution.
Now, I’ve got enough experience to know that it is possible to enter Ctrl+S to pause output, which is not fun to discover if you are used to using that shortcut to save files and suddenly find your system acting like it froze. The easy solution is to remember to hit Ctrl+Q to unpause output.
But that’s not what I was experiencing, although the symptom looked similar. I could see the cursor blinking, which indicated to me that the terminal was still active. But Ctrl+Q didn’t unpause, and I know I wasn’t doing anything close to hitting Ctrl+S in the first place.
I’ve tried searching online, but most people talk about the pausing/unpausing thing above.
For a bit, I thought I was having a faulty keyboard issue in that it was sending signals that it shouldn’t. One symptom I found was that it would sometimes open a new tab, and I almost never open tabs for my terminals. I usually just open a new terminal.
I thought the freezing terminal might have been Vim, but the file in question isn’t that large, and I write most of my code in Vim all the time without experiencing this issue, so what gives? It only seemed to happen when I was writing in my daily log, which I use to document what I did the day before, such as tracking how much time I spent on game development or writing.
Well, the other day it seemed to be occurring more frequently than usual, so I tried experimenting.
I found that I could reproduce accidentally opening a new tab whenever I typed the word “minutes” but only when I did so quickly, and often when I typed something before it. I type that word every morning in my log, and I’ve really only seen this issue happen when I was writing in my log.
But I found I could get it to occur without Vim, just having the terminal at the Bash prompt. So it is definitely related to the terminal program itself.
When a new tab would mysteriously appear, I could see that I had typed “min” in the original terminal tab, and “es” was in the new tab, so something was happening when I was typing “ut.”
But in order to open a new tab, the keyboard shortcut is usually Ctrl+Shift+T. But I wasn’t touching Ctr+Shift at all, so that made me think it was definitely the keyboard glitching.
That is, until I saw this menu appear:
Why did that menu appear? Well, apparently as I was typing quickly to try to reproduce the issue, which I had done successfully multiple times, my right palm accidentally hit my keyboard’s menu key, the one key I never purposefully use which is located between the right alt and right ctrl keys.
And if you look closely at the menu, you’ll see that it has a keyboard shortcut for opening a new tab. When this menu is open, you just hit “T” instead of Ctrl+Shift+T.
I realized then that I must be palming the menu key accidentally, then hitting the letter T to open a new tab. And I must be doing it so quickly that I never see the menu pop up.
It Turns Out that Terminal Has a Read-Only Mode
But what else is there? There’s a “Read-Only” mode? And the keyboard shortcut is “O” to toggle it on or off?
Apparently when the terminal appears to freeze, the issue is that I must be accidentally hitting the menu key on my keyboard with my palm, then typing the letter O so quickly that I don’t see the menu appear.
And the solution is to purposefully open that menu and typing O (or clicking the menu entry with my mouse, but come on, that seems wasteful) to toggle Read-Only mode back off. Alternatively, terminal has its own non-shortcut-enabled menu which a Read-Only checkbox to toggle.
So there we go. If you didn’t hit Ctrl+S to pause your terminal’s output and need to hit Ctrl+Q to unpause it, you might have also accidentally put your terminal into Read-Only mode and need to toggle it back off. Mystery solved.
I hope this information helps someone out there. I might still investigate getting a new keyboard, but maybe I can adjust my posture instead for now.