69

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.

10 Answers 10

106

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.

2
  • Sometimes after I run this one program (k9s, awesome kubectl terminal UI), this happens. The reset command worked, thanks!
    – Oliver
    Oct 9, 2020 at 13:37
  • 4
    I really should have looked for this answer 10 years ago
    – Madbreaks
    Oct 7, 2021 at 18:52
103

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.

7
  • 2
    I just hit this, thanks for the answer. I wonder how it happened in the first place, but oh well (:
    – jwd
    Apr 29, 2019 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. Aug 24, 2019 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, 2021 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 1, 2021 at 16:53
  • 1
    It's VT220, and the proper way to reset is tput cnorm. Jun 12, 2021 at 23:52
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.

3
  • 1
    No, that's not it.
    – tshepang
    Feb 4, 2011 at 15:44
  • 1
    Aha, that's what happened to me! Thanks to you that I'm learning about Ctrl-Q now! Apr 27, 2011 at 12:29
  • 1
    Reading extra comments: I always wondered why did my terminal randomly lock. This might be it : D
    – arod
    May 23, 2018 at 13:42
5

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.

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.

1

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

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.

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

0

On Ubuntu 22.04.3 LTS 64-bit with Gnome 42.9 and Wayland, the cursor disappeared in all terminal apps for me, but worked fine in other applications like Firefox. I'm not sure what I did to cause it (I switch between applications with Alt+Tab, so that may have been involved).

None of the other escape sequences or keyboard commands in this thread restored the cursor in my case. However, I was able to fix the issue by holding Alt and pressing Tab while keeping Alt held, then wiggling the cursor on the application selection menu.

-1

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .