In 1996 Keith Shafer, and several others proposed a solution to the problem of broken URLs. The link to this solution is now broken.
So, you open a terminal, ssh to some server, start a long-running command and suddenly –
there’s a power cut / Moba or whatever program you are using dies / windows restarts
Is it all lost?
Well, yes. But there’s a way to avoid it:
screen (aka GNU screen, for easier googling) is basically a session manager for the terminal.
To start it, ssh to your server and type “screen”.
You will notice that the screen clears and you’ve got another shell prompt. This shell is running under the screen session.
You can work in the shell as normal (i.e, starting an interactive command, ssh to another server, etc), or you can send commands to the screen session using the Ctrl-A key combination (^a).
To get a list of screen commands, type Ctrl-A ?
(or better yet, look up a cheatsheet)
To detach from the screen session, type Ctrl-A d
– this will get you out of the session, but leave screen running.
You can re-attach to the running screen from any other terminal session by typing screen -r
If you’ve left the screen session running in another terminal, you can take it over in your current terminal by typing the command screen -rd.
So, to put together what we’ve learned:
Start a screen session:
Start a slow-running command in the shell:
$OUR_ROOT/tools/Foo/some_really_slow_script.pl -in ……
Leave it running, or detach with Ctrl-A d
Go home, reconnect to work (or go for lunch, come back after your machine rebooted by accident or whatever), ssh to the server where you ran screen, and type
to see if your script finished and carry on from where you left.
You leave screen by exiting all the shells you have open under the screen session, or with a keyboard shortcut I can’t be bothered to look up.
Bonus tips (i.e, all the screen commands my fingers know):
Ctrl-A c = open another shell session inside screen
Ctrl-A Ctrl-A = toggle between the two most recent open shell sessions
Ctrl-A ” = see a list of open shell sessions
Ctrl-A A = give a name to the current shell session
Ctrl-A ‘ = switch to a named shell session by typing (the start of ) its name.
Hope you find this useful,
The press must learn that misguided use of a computer is no more amazing than drunk driving of an automobile.
Tile Tabs is a Firefox extension which lets you view multiple web pages in one window – you know, like a tiling window manager or frames in a web page. I love tabs probably more than most people, but I started using split windows in Vim recently because sometimes you really want to look at two different files side by side, so why not web pages?
Typo in Haaretz produced the jolly headline “only a third in favour of ground nation”. Let’s move to Bespin now! I posted this on Facebook, Twitter and even Google Plus, might as well post it on the Internet.
We made this!
(Well, Guy did all the hard and creative work, I just wrote some code).
If you have young kids, give it a go. Hebrew version coming soon.