ssh into screen

Mar 23, 2014   #screen  #ssh 

There are a lot of occassions for using GNU Screen, most of them assume you need the ability to disconnect while leaving something running long term (e.g. irssi), and reconnecting at ad-hoc intervals.

Instead of doing something like

# local machine ssh # remote machine screen -R bar

You can merge everthing into one command

ssh -t screen -dR bar

This will create the screen socketname ‘bar’ if it doesn’t exist, and will reconnect to it if it does.

A bash alias can be used for repeatability.