screen is a handy tool. It lets you get more out of a terminal
session, whether in a window, via ssh, or by some more esoteric means.
Its original reason for existence was allowing you to switch between
subsessions on a video-display
terminal, but it grew to
allow sessions that could be detached and reattached (if you went home
for the day, or say you were connecting via a glitchy network) and
eventually to allow the same session to be simultaneously accessed
from multiple places.
stella foobarbazat an Athena prompt; one or several shorter aliases should be listed, such as, hypothetically,
fbb. On the MIT network, you don't even have to type
.mit.edu, so you can just
To detach, type "C-a d" (That's control+a, release both keys, press 'd'.) . To reattach, type
If you close your ssh connection without detaching, or lose your network connection:
-dr means "find my screen session, detach it from wherever it's
attached if it's attached, and reattach it here."
Once you're comfortable with this, hit "C-a C-c". This creates what screen calls a new "window"; it should give you a new shell prompt, and you can do stuff at it. If you want to switch back to the old "window", hit "C-a C-a". You can create as many "windows" as you want; you can switch to the first 10 of them with "C-a 0" through "C-a 9" and see a list of what's open with "C-a w". ("C-a C-a" actually means "switch to the previously used window".)
A useful shorthand:
screen -dR is like
screen -dr except
it adds a "if I don't already have a session, create one" step.
You can use
screen -x to attach a screen session that's already
attached somewhere without detaching it first. This can have side
effects if the other place is already attached or is in a window that
is a different size than your current one. It's useful when you want
to share context between different screens, or even different people,
but doing it when you're not sure where else your screen might be
attached has privacy implications.
screen can do lots of stuff. If you have a while to burn, run
man screen at the shell prompt. It may be helpful to do this
screen so you can put it down and come back to it later.
Some people (including the author of this sentence) use
tmux instead of
screen; it can do all of the same things
screen can, and may be easier to
Also, instead of normal
ssh, you can use
mosh (the mobile shell) to connect
to the Athena machine; it will be able to reconnect automatically if you lose
your Internet connection momentarily. An example alias:
alias athmosh='mosh --server="athrun mosh_project mosh-server" --ssh="ssh -K"'
ssh -K will pass along Kerberos tickets from your own machine, so if you
kinit yourkerberos@ATHENA.MIT.EDU and type your password on your
computer, you won't need to re-authenticate when running this command. You can
invoke this as