So I was working on homework on my school's unix server and I think I totally messed up a screen session. I was going a little trigger/keyboard happy in vim and accidentally did :w2 instead of just :w, so I sent vim to the background (ctrl+Z) and went to go delete it. Except that in my mad typing, I think I may have actually hit ctrl+Z twice, and... send the bash prompt to the background?? I'm not really sure what happened, I just know that I got out of vim but didn't get back to the prompt. I tried pretty much everything I could think of short of terminating the screen session, including a lot of random keysmashing.

The last usable output in the screen session is:

lcm72@tux1:~/cs380/SlidingBrickPuzzle (master)$ fg
vim BoardState.java

[1]+  Stopped                 vim BoardState.java

I've started a new screen session to continue working on the homework, but if anyone could help me understand what the heck happened here (I didn't think it was possible to ctrl+Z bash?) -- so I can recover it or even just not make the same mistake again -- I would appreciate it.

  • invoke fg %1 - it will bring your task back from backgound
    – Serge
    Sep 28 '16 at 15:52

If you typed Ctrl+ACtrl+Z, you could have suspended screen, not your whole screen session, just the screen viewer, the one that attaches to the script session to display it in the host terminal.

If that's the case ps -flHC screen would show you one screen process that's in the T state. You could try and resume it with kill -CONT if the host terminal is still there, or just kill it and re-attach to your screen session from another terminal with screen -x.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.