Is screen useful?

When I need to open different processes or terminals that I need to check, I just open a new tab in my terminal and use different workspaces in my machine to keep everything organized.

I do some web development, using a Linux machine. I’ve seen that a lot of people use screen to accomplish what I’m doing, but I can’t see any advantage. In fact, I thought it would be worse since now I have to remember all states in screen instead of having some terminals in a workspace named “terminals”.

What am I missing? How do you actually use screen?

It’s particularly useful when you don’t have access to a graphical environment. For example, when you’re on an ssh connection with no X11 forwarding.

Answered By: Dennis Williamson

I use screen both locally and remotely. I find that I use screen because it gives me the ability to

  • Run multiple tasks without making multiple ssh connections to a remote server,
  • Run a long-running task in screen, detach, disconnect. The job will still be running in screen and I can come back later, reattach, and check its progress.
  • Have a more or less persistent workspace on a server, which is nice when I am doing something that involves multiple steps over the course of a day.
  • Receive important system information in a non-intrusive way using the screen profile customizations provided by byobu.
  • Use “Named Tabs”: In screen I can give each “tab” in screen a name, allowing me to instantly know where to switch to.
  • Use more keyboard shortcuts. If you do most of your work at the computer, not having to use the mouse is a real plus. I find that screen‘s keyboard shortcuts provide a bit more power, but this may just because I’ve never invested in truly learning all of the GTK shortcuts.

Here is a screen shot of a recently started screen session using byobu and other customizations:
Screen using Byobu

Answered By: Steven D

I know people that use screen as a tabbed console; I don’t. It’s very useful if you want to leave interactive programs open without actually having a console connected all the time, especially if you want to be able to access those programs from multiple computers over SSH. For example, I keep my IM client open in a screen session on a server, so I’m always online, and I can connect to it from whatever computer I happen to be on

Answered By: Michael Mrozek

Heck yes! Screen (along with synergy) is one of my favorite programs. I use it every time I connect to our servers, and often just on my local machine.

Beyond what others have already mentioned, screen protects you from blips in network connections. When I’m working remotely (coffee shop, airport, etc) our VPN doesn’t always play well with some networks. The VPN will disconnect and reconnect often. Using screen protects what you’re working on from getting lost if one of these blips happens at a bad time.

Regarding ‘remembering all the states’, it helps to set up a status bar. In my .screenrc file, I have the following (among other stuff)

hardstatus alwayslastline
hardstatus string '%{= kw}[ %{= kb}%H%{= kw} ][%= %{= kw}%?%-Lw%?%{= kW}%n%f %{b}%t%{w}%?%?%{= kw}%?%+Lw%?%?%= ][ %{r}%l%{w} ]%{w}[%{r} %d/%m/%y %C%A %{w}]%{w}'

This shows details about where I am, which tab I have open. I will name my tabs based on either what server that tab is connected to, what folder I’m in, what process/script is currently running, or what file I have open.

Answered By: David Oneill

Down to basics: it allows you to detach session and “transfer” running cli apps from one env to another (you can use the same irssi client in X and then in tty4 without closing irssi and reopening session in it). I find pretty annoying to have to reopen programs when i transfer some work and running apps from Xorg server to cli env (ttyX terminals). This way i just type

screen -R

and voila: my vim session, my moc playlist, my alpine mails, my last used dir in mc, my rss reader etc. are loaded in my terminal in a blink ov an eye without any reconnection or re-authorization.

Answered By: user2648

Yes, screen is useful. Here’s why in 8 easy steps:

  1. ssh you@somehost
  2. screen
  3. start doing something really important
  4. unplug the router / turn off the power in the building / spill coffee on your laptop (etc[*])
  5. panic
  6. get things back up an running
  7. ssh you@somehost
  8. screen -d -r
  9. continue doing what you were doing before #4

Ok, so that’s 9 steps, but… you get the idea. screen is also great for all the other things people have mentioned, as is tmux, a BSD licensed alternative that is somewhat new to the game.

[*] here, etc refers to anything not involving the host you initially ssh’d to. screen isn’t that good.

Answered By: gabe.

There are other cool features of screen including multiuser screen sharing and screen logging. For example if you’re trying to train new person on some particular task you can have them connect to your screen session or connect to theirs and then you can watch each other type. If you see them making a mistake you can make the change directly on the command line while they watch. It’s very helpful.

Screen logging can record the whole session so if the trainee wanted to review what he did he could watch/read it again. This can also be very useful if you have a guest consultant working on your system as it allows for review of their work.

Answered By: Hath995

Yes, it’s extremely useful like others have explained.

Also, don’t forget other similar tools like Tmux, which lets you share terminals more easily than screen, and also lets you split horizontally and vertically.

Answered By: Not Now
Categories: Answers Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.