| « Virtual networking | Letting vim take the strain » |
Mon, Feb 17, 2014
![[Icon]](rsc/img/chain_link.gif)
I've been a big user of GNU Screen for.. erm... hang on, let me count.. OMG, it's been very near to two decades now. Holy *&^%!
(I've looked at tmux a few times but never found any compelling reason to switch)
I first started running it at University because the servers weren't the fastest, and I didn't want to hang around for ages waiting for my email client to start up & load all the messages just so I could tell if I had any new ones. Also, I was on a few MUDs and things, which I also didn't want to have to keep re-joining. So I would just leave myself logged in via Screen and re-attach to it as and when. Quite a time-saver.
I started using it for work purposes a couple of jobs ago because it was the most convenient way to share a screen to work with somebody else: You can grant other users permission to acccess your session via 'acladd'
That worked great when I was doing all work on one remote machine, but then at my last job, I was working on multiple servers & VMs. I really needed one Screen running on each box, but that then meant I needed too many windows. So I started a new trend: A container Screen that all my other Screen sessions could live within. So long as the container used a different escape key to the usual Ctrl-a this was no problem.
And now in my current workplace I again feel the need for multiple screens, because I again need to be on multiple machines at once, and also I have multiple scripts & utilities running in the background whenever I'm logged in.
Ordinarily, I just set them up manually and got on with it, because I reboot so rarely. But we've had a few power cuts lately, so I finally decided to automate it all.
So now I have a script that starts up three screen sessions for me, via the format:
The -S switch gives the session a name, which is vital when running multiple screens: You can attach via screen -x name instead of having to know/guess the right ID number.
Each session has its own config file, because: the container needs to have a unique escape key (I use X in the place of A); Some screens I want to have a visible toolbar, others I don't; and I want to run different startup commands for each.
And then in the config files, I have entries in the format:
So I can define the name of the individual screens within each session; what number they start on; and what command they run on startup.
This means a single command run on startup gives me easily-navigable screens connected to multiple machines, bring up IRC&IM, load utilities like my dynamic wallpaper (Xplanet), and set up some ssh tunnels.
Very convenient.
It feels like I just levelled up the the next level of geekiness, and it's hard to say whether that should engender pride or shame :)