63

It happens often that my cursor on gnome-terminal disappears, forcing me to work on a new tab/window. It seems like a random occurrence. Does anyone else experience this? What about other X terminal emulators? How can I fix this (or maybe it's just a bug)?

update: A simple work-around is to switch away from the terminal and switch back.

update 2: I don't experience this any more, maybe because I'm using GNOME 3 version of the terminal.

tshepang
  • 64,472
  • 86
  • 223
  • 290

9 Answers9

102

If running Ctrl+Q (as described in another answer) doesn't work, it's possible that your TTY has been mangled by some other program you've run. Try running the reset command and then the clear command (or Ctrl+L, its equivalent) to initialize your terminal.

Stephen Kitt
  • 411,918
  • 54
  • 1,065
  • 1,164
jsbillings
  • 24,006
  • 6
  • 56
  • 58
93

You may have inadvertently hit the VT220 escape sequence to hide the cursor. If so, then neither Ctrl+Q, nor reset, nor clear, nor Ctrl+L will help.

What worked for me was to send the VT220 "unhide" command sequence.

As suggested in a comment from Thomas Dickey, and the answer from Quigi the right way to unhide the cursor is to use the tput command to send the command sequence like this:

tput cnorm

(in my original answer I had been sending the command sequence by invoking echo -en "\e[?25h")

You can learn more about cnorm and all the other possible command sequences you can send with tput by looking at the man 5 terminfo man page.

Wandering Logic
  • 1,341
  • 11
  • 11
  • 2
    I just hit this, thanks for the answer. I wonder how it happened in the first place, but oh well (: – jwd Apr 29 '19 at 21:37
  • 1
    This is by far the most likely(and useful) explanation. Switch off software flow control in the other instances, so ctrl-q/ctrl-s do nothing. – Graham Nicholls Aug 24 '19 at 16:14
  • I guess this escape sequence may show up when we are copying/pasting text from one terminal emulator window to another. – Esmu Igors Jan 21 '21 at 15:24
  • This happens for me whenever an ssh session gets disconnected. Using `st`, only the `echo -en "\e[?25h"` solution works. – tsj Mar 01 '21 at 16:53
  • It's **[VT220](https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h4-Functions-using-CSI-_-ordered-by-the-final-character-lparen-s-rparen:CSI-?-Pm-h:Ps-=-2-5.1EC4)**, and the proper way to reset is `tput cnorm`. – Thomas Dickey Jun 12 '21 at 23:52
  • @ThomasDickey Interesting! I read the man page for tput but don't see this. Where can I find more info about `cnorm`? – Speeddymon Apr 25 '23 at 18:19
  • I hadn't seen Thomas Dickey's comment before. I've revised my answer. – Wandering Logic Apr 25 '23 at 19:54
8

Could it be that you inadvertently press Ctrl+S, sending XOFF to your terminal and thus locking it?

Next time it happens, try pressing Ctrl+Q to unlock it.

techraf
  • 5,831
  • 10
  • 33
  • 51
Andrea Spadaccini
  • 433
  • 1
  • 4
  • 8
2

Try tput cnorm. It brought back the cursor on my xterm. As it is based on terminal capabilities, it should be general, not specific to a particular terminal. Also, it's less disruptive than reset, and much simpler than re-installing software.

Quigi
  • 141
  • 1
  • 3
1

Press (CTRL+G) or (CTRL+A)then (Ctrl+L) to initialise terminal. This worked for me, first selecting the group then initialise.

Shaze
  • 109
  • 3
1

I landed here when searching for "chromeos terminal cursor disappeared". Turns out that it was just too dark to see in the default "dark theme". Switched to "light theme" instead.

Shadi
  • 129
  • 3
0

This occurred on my PC with Ubuntu 18.04 (GNOME terminal 3.28.2). I tried the command reset, clear as well as Ctrl+L and these did not enable the cursor for me.

I gave in and used the mouse with the menu item 'Terminal|Reset and Clear' and this worked.

artless noise
  • 151
  • 1
  • 6
0

After numerous inspection, try and errors, I can say that the input method (especially non-latin-letter language) may encounter this problem. I use HIME-IM and I believe sometimes it "kidnaps" the input cursor. Changing terminal software/apps does not help if being kidnapped. However, here are some solutions if none of the above works:

  1. Just do an input method switch (like ctrl+space), and then the cursor comes back in the terminals,

or

  1. Open up the input method for configuration and then close it without anything else, and then it comes back.

This is really annoying but the disappearance of the cursor is more annoying. FYI

Greenonline
  • 1,759
  • 7
  • 16
  • 21
MTP1984
  • 16
  • 1
-1

reinstalling gnome,gnome-terminal, and gnome-core solved it for me.