Set the cursor of Ubuntu terminal to turn on automatic display

directory
Terminal cursor disappearance causes echo and hide cursor methods boot automatic echo cursor summary

The reason the terminal cursor disappears
When I was using the Ubuntu subsystem terminal, the cursor would often disappear after a single action. Now I suddenly found the reason for the switch between Chinese and English input. When I just entered the terminal, because it was Chinese input, I did not pay attention to typing a few words, so I switched to English with shift casually, and then the cursor disappeared. If you want to retrieve the cursor, press shift to switch the input method to see the cursor.
Echo and hide cursor methods

# Hide the cursor
echo -e "\033[?25l"

# Show cursor
echo -e "\033[?25h"

Power on auto echo cursor
I mainly encountered the following problems in the process of using the Ubuntu subsystem. Although the above command can be normally displayed back to the cursor each time, once the terminal is closed, the cursor is not opened again, so I need to continue typing the above command, but it is very troublesome to go one after another, so I have the following solution ideas.
write shell script, named cursor_show.sh :

#!/bin/bash

echo -e "\033[?25h"

Set automatic startup execution, /etc/init.d/ directory is stored in the program of automatic startup execution:

>$ chmod +x cursor_show.sh
>$ sudo mv cursor_show.sh /etc/init.d/cursor_show.sh

conclusion
This is my personal solution to the ubuntu subsystem, but if you have the same problem on other Linux systems, try it.


Read More: