Linux terminal suspended animation problem, the solution

Sometimes in the shell terminal under Linux, the terminal application is stuck suddenly and cannot accept keyboard input, but the system is normal for other split screens. This was originally a very old function of a terminal, called software flow control (XON/XOFF flow control). Specifically, when the client (terminal emulator), that is, the commonly used terminal emulator, cannot accept more data, the terminal will Send a "XOFF" signal to tell the sending data end to suspend transmission until it receives the "XON" signal, where the "XOFF" sent tells the kernel's tty driver to set the process of sending data to sleep, until the tty driver sends "XON" "Tell the kernel to resume the process as if it never stopped.

By default, Ctrl-s will enable the scrolling lock of the terminal. At this time, the scrolling function of the terminal emulator is disabled (by sending the "XOFF" signal to suspend the output of the software), the terminal software has no output, causing the phenomenon of suspended animation. It was just pressing the ctrl+s shortcut key unconsciously. Correspondingly, Ctrl-q will disable scroll lock and resume terminal scrolling (recover the output of the software by sending the "XON" signal).

You can modify the configuration file, add the following parameters to the configuration file of ~/.bash_profile or ~/.bashrc and restart to load the bash configuration to disable this function, and it will not be suspended:

stty -ixon
source .bashrc

By the way, the ctrl+z command in the terminal under Linux will switch the current task to the background for execution, and it will no longer be able to see it. You can use the fg command to restore to the foreground.

Guess you like

Origin blog.csdn.net/weixin_46537765/article/details/107402460