Screen
From Waisman Brain Imaging Wiki
'screen' is a very handy UNIX command that lets you run several different tasks in a single window. In essence, it displays one of the tasks, and lets you switch between it and the others. It is very easy to use. From a UNIX command prompt, type
screen
Then just go ahead and run your first job ( MATLAB, SAS, gzip, etc.).
Once you've got it running, type Ctrl-A (the "Ctrl" or "Control" key and the "A" key at the same time). Then type "c" to create another task screen. Your running job will vanish (but it's OK; it is just hidden, not gone) and you'll get a command prompt. You can now run another job.
To get back to the first job, type "Ctrl-A" then "n" (next). You'll see the first job again.
To go back to the second job, type "Ctrl-A" then "n" again (it will loop through all of the jobs you've created).
When you are done with one of your jobs, just type
exit
at its command prompt, and the job screen for it will close, and you'll see the one "hidden" behind it. Type "exit" enough times, and you'll quit out of 'screen' altogether.
Here are the 'screen' commands you'll need to get going. The ones that start with "Ctrl-A" can be used at any time; the other ones (like "screen" and "next") can only be used at the command prompt:
- Ctrl-A c Create another job screen
- screen <myNextCommand> Another way to create another job screen and immediately run <myNextCommand> in it. For example, screen matlab.
- Ctrl-A n or
- next Switch to the next job screen
- Ctrl-A p or
- prev Switch to the previous job screen
- Ctrl-A ? Help; list all of the 'screen' commands
- Ctrl-A [ or
- copy Get ready to select text to copy
- arrow keys, h, j, k, l Move around on the screen to select the text to copy
- space bar Mark the beginning and end of the selected text to copy; the second time you press the space bar, the selected text will be ready to paste
- Ctrl-A < Read a file into the text copy area
- Ctrl-A ] or
- paste . Paste the copied text at the current cursor location (note the period at the end of the command; it means "use the default copy area")
- Ctrl-A > Paste the copied text into a file
- exit Exit from the current job screen
- wtf What you'll say when you've got 12 jobs running under 'screen' and you can't figure out where that one MATLAB job got off to.
- quit Completely quit from 'screen' and kill dead dead dead all of the jobs in it. DANGEROUS!!!
'screen' has a lot more options and capabilities. To read about them all, type 'man screen' at a command prompt.
Back to UNIX.

