What GNU Screen is not.
It's not a full fledged solution to open, detach and reattach graphical session. It's not VNC or similar software.
What GNU Screen is.
Technically it's a screen multiplexer. This means that with screen you can literally multiplex physical terminals, launch processes inside them, detach from sessions and reattach from whichever machine. Screen is pretty powerful and I suggest you to read the official documentation. Nevertheless, a quick crash course may be useful.
Installing GNU's screen (a screen multiplexer).
This applies only to Solaris 10. Screen is also included in some Solaris Express and OpenSolaris versions. As usual, I'll install it from Blastwave, which will take care of all dependencies (which in this case it's just CSWcommon which will be installed if you'd already configured Blastwave on your machine). Here's the package and here are commands. First, let's refresh the software catalog from out preferred mirror:
# /opt/csw/bin/pkg-get -UThen, let's install screen:
# /opt/csw/bin/pkg-get -i screenHow to start a screen session
It's easy, just typing screen:
$ screenScreen will present you a welcome screen and hitting space or enter will bring you to your new screen session. Since now on, every process will be running inside screen's multiplexed physical terminal.
Exiting a session
This is easy too. Just exit screen as you'll exit your favorite shell:
$ exitDetaching from a session
[screen is terminating]
If you want to detach from the current session and leave programs running, you can just hit CTRL+A,D and you'll detach the screen you're using:
$ [hit CTRL+A,D]Listing the open sessions
Sessions are maintained on a per-user base. Just log in with your user and type:
$ screen -lsScreen's telling you that you have 3 open sessions: one is a detached screen (4544.console.PCS30575) and another two which are probably dead session you couldn't wake up any more. If you want to wipe them, just use the wipe option (note that the using the PID is sufficient because we're connecting from and to the same machines we detached screens from):
There are screens on:
3492.console.PCS30575 (Dead ???)
6028.console.PCS30575 (Dead ???)
Remove dead screens with 'screen -wipe'.
3 Sockets in /tmp/uscreens/S-A144286.
$ screen -wipe 3492You can know wipe the other one. To reattach to the 4544 session:
There is a screen on:
1 socket wiped out.
No Sockets found in /tmp/uscreens/S-A144286.
$ screen -r 4544If you check screen documentation you'll see plenty of options which allow you to detach and reattach with a single command (if you're connecting from another client and you left a session open on another machine), etc.
Launching a command on a new screen session and detach it immediately
This is one of those I use most. If you need to launch a program and you want to launch it inside a new screen session without even attaching to it, you can use the following syntax:
$ screen -m -d [your-command]This will create a new session, launch your-command inside it and leave it detached.