Screen, a terminals best friend
Posted by slayton on May 31, 2009
One of my favorite things about using linux is the terminal. One thing that annoyed me when I started using linux was if I started an application in the terminal I had to leave the terminal running; if I closed the terminal the running application would also close. The simple solution to this problem is a little appliction called screen.
Next time you run an application in a terminal start it with screen:
screen <application_name>
Then you can close the terminal and the application will keep running. If you want to regain control of the terminal running the application use the following command:
screen -R
If more then one screen session is running you’ll get a prompt like this:
There are several suitable screens on:
18771.pts-7.stockton-mini (05/31/2009 07:21:39 PM) (Attached)
18613.pts-4.stockton-mini (05/31/2009 07:21:11 PM) (Attached)
18551.pts-0.stockton-mini (05/31/2009 07:21:08 PM) (Detached)
8005.pts-0.stockton-mini (05/31/2009 12:57:11 PM) (Detached)
Type “screen [-d] -r [pid.]tty.host” to resume one of them.
In that case simply pick the session you want to resume and enttypeer the PID following the -R, use tab to complete the line and you’re all set.