Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to detach an inner screen session

Tags:

gnu-screen

I usually use gnu screen like this: 1. start a screen session for all my tasks 2. When I login to a machine, I connect to a screen session (screen -x) made by my colleague (so this makes it an "inner screen")

Problem is, when I need to detach from the "inner screen" via ":detach" command or ctrl+a+d, I get detached from my main screen (in #1).

Is it possible to detach from "inner screen"?

Thanks

like image 746
icasimpan Avatar asked Aug 28 '12 06:08

icasimpan


People also ask

How do I detach from a screen session?

To detach it, type Ctrl-a Ctrl-d (most commands in screen start with Ctrl-a, this overrides the Ctrl-a command normally used when you want to jump to the start of a line).

How do I detach from a nested screen?

s1 by doing: ctrl-a d. s2 by doing: ctrl-a a d. s3 by doing: ctrl-a a a d.

How do you detach and reattach a screen?

To start a screen session, you simply type screen within your ssh session. You then start your long-running process, type Ctrl+A Ctrl+D to detach from the session and screen -r to reattach when the time is right. Once you have multiple sessions running, reattaching to one then requires that you pick it from the list.


1 Answers

Use ctrl+a, a to send ctrl+a to the inner screen. That is, to detach the inner screen press ctrl+a, a, d. Alternatively press ctrl+a, a, and write :detach.

I also work with the same screen setup as you and found it more convenient to change the ctrl+a shortcut to ctrl+l (lower case "L") on my local machine. That way you can access the inner screen directly with ctrl+a instead of the tedious ctrl+a, a. To do that add this to your local ~/.screenrc:

escape ^La
like image 160
Backlin Avatar answered Sep 18 '22 12:09

Backlin