Linux screen – quick start guide

When working on remote Linux terminals its a good idea to use screen manager as it will protect your session from disconnection. Here are some handy command when using screen on Linux or Mac environment:

starting a screen session

Start a screen session

$ screen

Start a screen session with sessionname

$ screen -S foo

List running sessions

$ screen -ls
There is a screen on:	(07/28/2015 01:33:46 PM)	(Attached)

resume already running session

Reattach a session after detaching is necessary

$ screen -d -r

Reattach a named session after detaching is necessary

$ screen -d -r foo

Attach to non-detached screen (multi display)

// Assuming foo is an attached session
$ screen -x foo

Detaching from a screen session

Detach from a screen session so that you can attach to it later:

$ ctr-a and then ctr-d

Note that ctr-a is necessary otherwise it may exit from screen session.

Kill a screen session

Kill detached screen session

$ screen -S foo -X kill

Kill current screen

$ ctr-d 
// or 
$ ctr-a :quit
Share this article: share on Google+ share on facebook share on linkedin tweet this submit to reddit


Click here to write/view comments