Screen. What can I say about it? It’s not very well known to many people I mention it to but its one of those programs that you just can’t stop using once you’ve started. Yes, I use screen on a regular daily basis and it’s really easy to use.
I know someone who says the only reason they invented X was so that you could use more virtual terminals. I think the real solution behind great command line multitasking is screen!
Here are some basic usage tips. To start a command line based program within a virtual ‘screen’ prefix that command with screen, such as:
Once that has loaded you can detach the virtual screen for later use by pressing ctrl-a d. To reattach that screen type screen -r (or, if the screen was somehow not completely detached previously you would use screen -dr).
Now, ok, I can start applications within screen and detach them.. that’s cool I guess but couldn’t I just background the process or something similar? I suppose so, but here is where it gets interesting.
Create a new screen instance within screen with ctrl-a c. Do this as many times as you might need, based on the number of apps you’re using. To later switch between these screens use ctrl-a 0-9, ctrl-a n,p (for next or previous) or to see a visual list, use ctrl-a “.
To close a screen you no longer need you can simply type exit which will take you to the next screen or exit screen completely if it is the last one.
In my setup I’m running irssi, mutt, bash and snownews within screen 0-3 over ssh to a private server at home. On my local machine I load screen for rtorrent and an irssi notification script. Once I get them both going I ctrl-a d, close gnome-terminal and don’t bother with those apps until I need something. At that point I screen -r and there they are again, right back where I left them.. and having continued that whole time. Like I said, easy multitasking on the command line.
Do you have any magic screen tips to share with the crowd? You know where the comments go.