Sometimes when I edit my file using vi or vim, my file just freezes. Even if I type Ctrl+C or Ctrl+D, it still freezes there. I kill -9 <pid>
from another terminal, the pid is killed, but the file still freezes there.
I guess I must have typed some combination of key which I do not know. Does anybody have an idea?
How to Unfreeze Vi Editor or Unix Terminal? You can unfreeze or resume the terminal using Ctrl+Q.
If you've made mistakes along the way in your editing and want to back out (abandon) all non-saved changes, enter Command mode by pressing Esc and type :q! This command quits without saving any changes and exits vi.
To Start vi To use vi on a file, type in vi filename. If the file named filename exists, then the first page (or screen) of the file will be displayed; if the file does not exist, then an empty file and screen are created into which you may enter text.
TL;DR – How to Exit Vim If you didn't make any changes, type :q and press Enter / return. If you made some changes and would like to keep them, type :wq and press Enter / return.
Ctrl-S is probably the culprit; it stops your screen output in most terminals. As Michael mentioned, you can restore your screen to normal by entering Ctrl-Q.
Theoretically, setting stty -ixon
should prevent Ctrl-S from freezing your screen, but it's not working on my local Solaris 10 login.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With