When trying to save a file with Emacs during an interactive job, the screen froze

It is caused by the flow control by specific input characters, enabled on the default terminal setting.

Flow control is a function to temporarily hold a data transfer in order to prevent overflow of the receiving side, for example, when the transmission speed exceeds the reception packet speed in data transfer. In general, Ctrl+S is used for pending transfers, and Ctrl+Q is used for restart as control characters.

When editing with Emacs interactively and overwrite saving, you have to enter Ctrl+S, but it is also a flow control character, so the packet will not be transferred and it will be as if it were frozen. To fix, please enter Ctrl+Q.

To disable flow control, you need to execute the following command before running interactive job.

stty -ixon

If you want to always disable flow control, add the above command to .bashrc in your home directory.