Back to top

linux screen cheat sheet

Let's say that you are running a command on a linux shell and it's taking a long time. Further, you need to disconnect your session to get on the bus or your session gets disconnected because your net connection is flakey.

Screen to the rescue

Imagine if you could just disconnect from your shell session and then reconnect. Well, you can :)

Screen Cheat Sheet

Command What it does
ctrl+a+c make a new screen
ctrl+a+n "next screen down the line"
ctrl+a+p "previous screen down the line"
ctrl+a+k kills current screen until last one then you're out
ctrl+a+d leave, but leave them running and re-attachable
screen -ls 31619.something.else (Detached)
screen -r 31619.something.else re-attaches to that session

So - that quick guide should provide the commands you need in the order you need them. And then you'll be more productive and then you'll be happier because you'll be doing it efficiently :)

People Involved: 
timeline: 

Comments

re-attach

What I use all the time:
screen -DDR
to re-attach any (the first) detached session.
If there is none, it creates a new session.