I thought everyone knew it. But very few actually do. Especially young software engineers. Probably everyone uses a GUI today and don’t interact much with the terminal. In fact many of the new hires at my firm have only heard of the term multiplexer, but never really bothered to use one. So I thought I’d just write a bit about it.

I used to be normal putty user till 2011 (which is a shame). Then my friend introduced me to screen. At first I thought “OMG! What a mess! I would have to remember so many commands!”. But in less than a month I was a big fan of screen and had learned a lot more than necessary information about it. When you work in a company that gives you laptops as your primary workstation, your putty session dies off when you dock your laptop off or go to the next floor. So screen helped me maintain my session and made me less worried about saving work on the terminal. And it is so convenient, when I have long running tests or scripts, I just don’t bother waiting, switch to another window and keep working.

In fact today I can’t imagine working on the command line without a terminal multiplexer. Yes that is what screen is. In case you didn’t know. A little bit about multiplexer. A terminal multiplexer allows you to have multiple terminal connections inside the same terminal. Just like using different windows for different instances of the same application, a terminal multiplexer allows you to maintain multiple connections to the same box that you are connected to. And depending on your server admin’s settings there could be limits on the amount of memory your sessions could consume, like for me at my current firm, it is about a gig.

GNU’s screen is one such application that allows you to do that. Now you must be wondering “if I wanted to start a different window, why not just open another instance of Putty?” Well, those Putty windows are opened from your laptop/pc and as soon as you close them, your connection that was established would also terminate. Anything that you were working on would come to an end, either abruptly unless you closed your active tasks gracefully.

Multiplexing from a terminal, actually runs an application on the server that you are connected to that gives you the ability to create new connection windows/terminals on the same box/server/host that you are connected to. And that application would remain running and save the status of activity on each virtual terminal for you until of course the server/host/box or what ever you call it, is switched off. That means, even if you accidentally closed your Putty or whatever terminal emulator you were using, your sessions would be saved by the application called terminal multiplexer on the server, which you would re-connect to any time later. Pretty cool huh? Cool if you actually understood what I meant.

There is more to say about this. I’ll write more in my next post. If you are curious, search more about this and find out for yourself.