SSH is great for accessing my home FreeBSD server. Unfortunately, sometimes an install takes too long and I need to disconnect from the session without stopping the current process. Screen to the rescue. First, install it from the ports collection.
#cd /usr/ports/sysutils/screen #make install clean
Next, execute the screen command. This will create and attach to a new screen session with a single window. To list all screen sessions use the screen command with the “-ls” option. To reattach to one of those listed sessions use the “-r session_name” parameter.
While attached to a screen session, commands can be sent to the screen instead of the window shell by typing ctrl + a followed by the command key. Here is the help displayed using ‘?’.
Screen key bindings, page 1 of 2.
Command key: ^A Literal ^A: a
break ^B b license , removebuf =
clear C lockscreen ^X x reset Z
colon : log H screen ^C c
copy ^[ [ login L select '
detach ^D d meta a silence _
digraph ^V monitor M split S
displays * next ^@ ^N sp n suspend ^Z z
dumptermcap . number N time ^T t
fit F only Q title A
flow ^F f other ^A vbell ^G
focus ^I pow_break B version v
hardcopy h pow_detach D width W
help ? prev ^H ^P p ^? windows ^W w
history { } quit wrap ^R r
info i readbuf < writebuf >
kill K k redisplay ^L l xoff ^S s
lastmsg ^M m remove X xon ^Q q
[Press Space for next page; Return to end.]
The basic key commands to needed by a beginner are ‘c’ (create window), ‘n’ (next window), ‘p’ (previous window), ‘k’ (kill window), ‘w’ (window list), ‘?’ (help), and ‘d’ (detach from session).
So give screen a try and explore the other features like logging and monitor.