home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


UNIX Power Tools

UNIX Power ToolsSearch this book
Previous: 3.6 Stop Accidental Bourne Shell Logouts Chapter 3
Logging Out
Next: 3.8 What tty Am I On?
 

3.7 Detaching a Session with screen

screen
If your system supports ptys ( 41.8 ) , there's a really useful program you should have. screen ( 12.9 ) lets you start a process - like a shell ( csh , sh , etc.), a news-reading program, or whatever - then whenever you want, detach the whole process and log out. You can then log in someplace later and resume where you left off - or have screen keep running whatever you started after you log out. You can start many windows, even on a non-windowing terminal, and switch between them.

Normally, you can exit screen by exiting each shell individually, or by using CTRL-a CTRL- \ to kill all sessions. And if you want to end a screen session but pick it up later on, you can exit using CTRL-a CTRL-d.

Instead of a screen is terminating message, you'll get one that says [detached] -followed by a prompt:

[detached]
%

To reattach the session later on, start screen with the -r option. You'll be placed in exactly the same screen session that you were in before. All your processes are still running - for example, if you were in the middle of editing a file in one of your screen sessions, the editing session is still active. You can just continue where you were.

This is great because it means that not only can you keep active sessions all the time (even if you log out), you can also resume them from different terminals. So for example, I could go home, log in from there and pick up exactly where I left off.

- LM , JP


Previous: 3.6 Stop Accidental Bourne Shell Logouts UNIX Power Tools Next: 3.8 What tty Am I On?
3.6 Stop Accidental Bourne Shell Logouts Book Index 3.8 What tty Am I On?

The UNIX CD Bookshelf Navigation The UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System