ℹ️ Skipped - page is already crawled
| Filter | Status | Condition | Details |
|---|---|---|---|
| HTTP status | PASS | download_http_code = 200 | HTTP 200 |
| Age cutoff | PASS | download_stamp > now() - 6 MONTH | 0.1 months ago |
| History drop | PASS | isNull(history_drop_reason) | No drop reason |
| Spam/ban | PASS | fh_dont_index != 1 AND ml_spam_score = 0 | ml_spam_score=0 |
| Canonical | PASS | meta_canonical IS NULL OR = '' OR = src_unparsed | Not set |
| Property | Value |
|---|---|
| URL | https://askubuntu.com/questions/124897/how-do-i-detach-a-screen-session-from-a-terminal |
| Last Crawled | 2026-04-08 11:13:49 (3 days ago) |
| First Indexed | 2017-07-01 23:20:53 (8 years ago) |
| HTTP Status Code | 200 |
| Meta Title | command line - How do I detach a screen session from a terminal? - Ask Ubuntu |
| Meta Description | null |
| Meta Canonical | null |
| Boilerpipe Text | This question shows research effort; it is useful and clear
251
Save this question.
Show activity on this post.
I know how to start a
screen
, and how to list different screens:
screen -ls
or to attach:
There are screens on:
2477.pts-0.server1 (Detached)
2522.pts-0.server1 (Detached)
2 Sockets in /var/run/screen/S-root.
$ screen -r 2477.pts-0.server1
But what is the key combination to detach from a screen session and keep it running?
muru
♦
209k
58 gold badges
520 silver badges
794 bronze badges
asked
Apr 24, 2012 at 22:48
This answer is useful
308
Save this answer.
Show activity on this post.
Ctrl
+
a
followed by
d
. Note the lower case. The [
screen
manpage
] has a long list of these shortcuts under "DEFAULT KEY BINDINGS".
answered
Apr 24, 2012 at 23:02
2
This answer is useful
80
Save this answer.
Show activity on this post.
To list your sessions, run:
screen -list
You can run any command under screen command like:
screen myscript.sh
Then press
Ctrl
+
a
(release) and then
d
to detach the process/screen (so it'll continue to run).
To resume detached process, use:
screen -r
If you have multiple, then add the session number after that.
You can also re-attach to already
Attached
screen by
screen -x
. Useful to investigate why it's attached, share terminal with someone or to watch/check somebody what they're doing.
For more help, either run
man screen
or within the screen press
Ctrl
+
a
, release and then hit
?
to see more shortcuts.
See also:
How to execute a command in screen and detach?
answered
Oct 28, 2014 at 10:50
This answer is useful
16
Save this answer.
Show activity on this post.
You'll probably see it listed like this in the screen man page:
^a - d
It's important the note the case of the letters as uppercase and lowercase will do different functions.
answered
Apr 25, 2012 at 0:01
This answer is useful
11
Save this answer.
Show activity on this post.
Create screen using this command:
screen -S testscreen
List the screen using this command:
screen -ls
Attache the screen using this command:
screen -r testscreen
Attache the multipurpose screen using this command (if already others are attached with the same screen):
screen -x testscreen
Detach the screen using this command:
screen -X detach
OR
Ctrl+a+d
Kill the screen using this command:
screen -XS testscreen kill
Terminate the attached screen using:
Ctrl+d
answered
Sep 15, 2022 at 6:14
This answer is useful
6
Save this answer.
Show activity on this post.
Some systems remove certain bindings by default. So it is best to look at the online keybinding page:
Ctrl-a ?
. You can also use the command prompt in
screen
:
Ctrl-a :detach
. Myself, I generally remove the key bindings for 'detach' and 'powerdetach', except on remote systems.
answered
Apr 25, 2012 at 0:26
1
You must
log in
to answer this question.
Start asking to get answers
Find the answer to your question by asking.
Ask question
Explore related questions
See similar questions with these tags. |
| Markdown | # 
By clicking “Sign up”, you agree to our [terms of service](https://askubuntu.com/legal/terms-of-service/public) and acknowledge you have read our [privacy policy](https://askubuntu.com/legal/privacy-policy).
# OR
Already have an account? [Log in](https://askubuntu.com/users/login)
- [Ubuntu](http://www.ubuntu.com/)
- [Community](http://community.ubuntu.com/)
- [Ask\!](http://askubuntu.com/)
- [Developer](http://developer.ubuntu.com/)
- [Design](http://design.ubuntu.com/)
- [Hardware](http://www.ubuntu.com/certification)
- [Insights](http://insights.ubuntu.com/)
- [Juju](https://jujucharms.com/)
- [Shop](http://shop.ubuntu.com/)
- [More ›](https://askubuntu.com/questions/124897/how-do-i-detach-a-screen-session-from-a-terminal)
- [Apps](http://apps.ubuntu.com/)
- [Help](https://help.ubuntu.com/)
- [Forum](http://ubuntuforums.org/)
- [Launchpad](http://www.launchpad.net/)
- [MAAS](http://maas.ubuntu.com/)
- [Canonical](http://www.canonical.com/)
[Skip to main content](https://askubuntu.com/questions/124897/how-do-i-detach-a-screen-session-from-a-terminal#content)
#### Stack Exchange Network
Stack Exchange network consists of 183 Q\&A communities including [Stack Overflow](https://stackoverflow.com/), the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
[Visit Stack Exchange](https://stackexchange.com/)
1. - [Tour Start here for a quick overview of the site](https://askubuntu.com/tour)
- [Help Center Detailed answers to any questions you might have](https://askubuntu.com/help)
- [Meta Discuss the workings and policies of this site](https://meta.askubuntu.com/)
- [About Us Learn more about Stack Overflow the company, and our products](https://stackoverflow.co/)
2. ### [current community](https://askubuntu.com/)
- [Ask Ubuntu](https://askubuntu.com/)
[help](https://askubuntu.com/help) [chat](https://chat.stackexchange.com/?tab=site&host=askubuntu.com)
- [Ask Ubuntu Meta](https://meta.askubuntu.com/)
### your communities
[Sign up](https://askubuntu.com/users/signup?ssrc=site_switcher&returnurl=https%3A%2F%2Faskubuntu.com%2Fquestions%2F124897%2Fhow-do-i-detach-a-screen-session-from-a-terminal) or [log in](https://askubuntu.com/users/login?ssrc=site_switcher&returnurl=https%3A%2F%2Faskubuntu.com%2Fquestions%2F124897%2Fhow-do-i-detach-a-screen-session-from-a-terminal) to customize your list.
### [more stack exchange communities](https://stackexchange.com/sites)
[company blog](https://stackoverflow.blog/)
3. [Log in](https://askubuntu.com/users/login?ssrc=head&returnurl=https%3A%2F%2Faskubuntu.com%2Fquestions%2F124897%2Fhow-do-i-detach-a-screen-session-from-a-terminal)
4. [Sign up](https://askubuntu.com/users/signup?ssrc=head&returnurl=https%3A%2F%2Faskubuntu.com%2Fquestions%2F124897%2Fhow-do-i-detach-a-screen-session-from-a-terminal)
[](https://askubuntu.com/)
1. 1. [Home](https://askubuntu.com/)
2. [Questions](https://askubuntu.com/questions)
3. [Unanswered](https://askubuntu.com/unanswered)
4. [AI Assist](https://stackoverflow.com/ai-assist)
5. [Tags](https://askubuntu.com/tags)
6. [Chat](https://chat.stackexchange.com/)
7. [Users](https://askubuntu.com/users)
8. [Companies](https://stackoverflow.com/jobs/companies?so_medium=askubuntu&so_source=SiteNav)
2. Stack Internal
Stack Overflow for Teams is now called **Stack Internal**. Bring the best of human thought and AI automation together at your work.
[Try for free](https://stackoverflowteams.com/teams/create/free/?utm_medium=referral&utm_source=askubuntu-community&utm_campaign=side-bar&utm_content=explore-teams) [Learn more](https://stackoverflow.co/internal/?utm_medium=referral&utm_source=askubuntu-community&utm_campaign=side-bar&utm_content=explore-teams)
3. [Stack Internal]()
4. Bring the best of human thought and AI automation together at your work. [Learn more](https://stackoverflow.co/internal/?utm_medium=referral&utm_source=askubuntu-community&utm_campaign=side-bar&utm_content=explore-teams-compact)
**Stack Internal**
Knowledge at work
Bring the best of human thought and AI automation together at your work.
[Explore Stack Internal](https://stackoverflow.co/internal/?utm_medium=referral&utm_source=askubuntu-community&utm_campaign=side-bar&utm_content=explore-teams-compact-popover)
# [How do I detach a screen session from a terminal?](https://askubuntu.com/questions/124897/how-do-i-detach-a-screen-session-from-a-terminal)
[Ask Question](https://askubuntu.com/questions/ask)
Asked
13 years, 11 months ago
Modified [3 years, 6 months ago](https://askubuntu.com/questions/124897/how-do-i-detach-a-screen-session-from-a-terminal?lastactivity "2022-09-15 06:14:43Z")
Viewed 759k times
This question shows research effort; it is useful and clear
251
Save this question.
Show activity on this post.
I know how to start a `screen`, and how to list different screens:
```
screen -ls
```
or to attach:
```
There are screens on:
2477.pts-0.server1 (Detached)
2522.pts-0.server1 (Detached)
2 Sockets in /var/run/screen/S-root.
$ screen -r 2477.pts-0.server1
```
But what is the key combination to detach from a screen session and keep it running?
- [command-line](https://askubuntu.com/questions/tagged/command-line "show questions tagged 'command-line'")
- [gnu-screen](https://askubuntu.com/questions/tagged/gnu-screen "show questions tagged 'gnu-screen'")
[Share](https://askubuntu.com/q/124897 "Short permalink to this question")
Share a link to this question
Copy link
[CC BY-SA 3.0](https://creativecommons.org/licenses/by-sa/3.0/ "The current license for this post: CC BY-SA 3.0")
[Improve this question](https://askubuntu.com/posts/124897/edit)
Follow
Follow this question to receive notifications
[edited Jun 27, 2017 at 5:16](https://askubuntu.com/posts/124897/revisions "show all edits to this post")
[](https://askubuntu.com/users/158442/muru)
[muru](https://askubuntu.com/users/158442/muru)♦
209k5858 gold badges520520 silver badges794794 bronze badges
asked Apr 24, 2012 at 22:48
[](https://askubuntu.com/users/26252/maniat1k)
[maniat1k](https://askubuntu.com/users/26252/maniat1k)
8,3901010 gold badges4040 silver badges5252 bronze badges
[Add a comment](https://askubuntu.com/questions/124897/how-do-i-detach-a-screen-session-from-a-terminal "Use comments to ask for more information or suggest improvements. Avoid answering questions in comments.") \|
## 5 Answers 5
Sorted by:
[Reset to default](https://askubuntu.com/questions/124897/how-do-i-detach-a-screen-session-from-a-terminal?answertab=scoredesc#tab-top)
This answer is useful
308
Save this answer.
Show activity on this post.
`Ctrl`\+`a` followed by `d`. Note the lower case. The \[[`screen` manpage](http://manpages.ubuntu.com/manpages/zesty/man1/screen.1.html)\] has a long list of these shortcuts under "DEFAULT KEY BINDINGS".
[Share](https://askubuntu.com/a/124903 "Short permalink to this answer")
Share a link to this answer
Copy link
[CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/ "The current license for this post: CC BY-SA 4.0")
[Improve this answer](https://askubuntu.com/posts/124903/edit)
Follow
Follow this answer to receive notifications
[edited Oct 16, 2018 at 5:18](https://askubuntu.com/posts/124903/revisions "show all edits to this post")
[](https://askubuntu.com/users/586957/max-bileschi)
[Max Bileschi](https://askubuntu.com/users/586957/max-bileschi)
10333 bronze badges
answered Apr 24, 2012 at 23:02
[](https://askubuntu.com/users/56481/soren)
[Soren](https://askubuntu.com/users/56481/soren)
3,19611 gold badge1616 silver badges22 bronze badges
2
- 15
I think that you mean \<kbd\>Ctrl-A\<kbd\> \<kbd\>d\</kbd\> (lowercase). The upper case (`D`) is 'powerdetach'.
Arcege
– [Arcege](https://askubuntu.com/users/9449/arcege "5,658 reputation")
2012-04-25 00:23:04 +00:00
[Commented Apr 25, 2012 at 0:23](https://askubuntu.com/questions/124897/how-do-i-detach-a-screen-session-from-a-terminal#comment149416_124903)
- 1
yes, as @Arcege proposes, \<Ctrl-A\> \<d\> detaches from current screen session. Which worked for me. \<Ctrl-A\> \<D\> seemed to wait something else and received "detach aborted" message as soon as I pressed any other Key. If \<Ctrl-A\> \<D\>\<D\> pressed you're detached and logout from ssh.
theme
– [theme](https://askubuntu.com/users/297524/theme "121 reputation")
2017-07-07 10:51:06 +00:00
[Commented Jul 7, 2017 at 10:51](https://askubuntu.com/questions/124897/how-do-i-detach-a-screen-session-from-a-terminal#comment1477749_124903)
[Add a comment](https://askubuntu.com/questions/124897/how-do-i-detach-a-screen-session-from-a-terminal "Use comments to ask for more information or suggest improvements. Avoid comments like “+1” or “thanks”.") \|
This answer is useful
80
Save this answer.
Show activity on this post.
To list your sessions, run:
```
screen -list
```
***
You can run any command under screen command like:
```
screen myscript.sh
```
Then press `Ctrl`\+`a` (release) and then `d` to detach the process/screen (so it'll continue to run).
***
To resume detached process, use:
```
screen -r
```
If you have multiple, then add the session number after that.
***
You can also re-attach to already `Attached` screen by `screen -x`. Useful to investigate why it's attached, share terminal with someone or to watch/check somebody what they're doing.
***
For more help, either run `man screen` or within the screen press `Ctrl`\+`a`, release and then hit `?` to see more shortcuts.
See also:
- [How to execute a command in screen and detach?](https://superuser.com/questions/454907/how-to-execute-a-command-in-screen-and-detach)
[Share](https://askubuntu.com/a/542671 "Short permalink to this answer")
Share a link to this answer
Copy link
[CC BY-SA 3.0](https://creativecommons.org/licenses/by-sa/3.0/ "The current license for this post: CC BY-SA 3.0")
[Improve this answer](https://askubuntu.com/posts/542671/edit)
Follow
Follow this answer to receive notifications
[edited Apr 20, 2017 at 13:06](https://askubuntu.com/posts/542671/revisions "show all edits to this post")
answered Oct 28, 2014 at 10:50
[](https://askubuntu.com/users/78223/kenorb)
[kenorb](https://askubuntu.com/users/78223/kenorb)
11\.1k55 gold badges8888 silver badges9393 bronze badges
[Add a comment](https://askubuntu.com/questions/124897/how-do-i-detach-a-screen-session-from-a-terminal "Use comments to ask for more information or suggest improvements. Avoid comments like “+1” or “thanks”.") \|
This answer is useful
16
Save this answer.
Show activity on this post.
You'll probably see it listed like this in the screen man page:
```
^a - d
```
It's important the note the case of the letters as uppercase and lowercase will do different functions.
[Share](https://askubuntu.com/a/124910 "Short permalink to this answer")
Share a link to this answer
Copy link
[CC BY-SA 3.0](https://creativecommons.org/licenses/by-sa/3.0/ "The current license for this post: CC BY-SA 3.0")
[Improve this answer](https://askubuntu.com/posts/124910/edit)
Follow
Follow this answer to receive notifications
answered Apr 25, 2012 at 0:01
[](https://askubuntu.com/users/52402/rwc)
[rwc](https://askubuntu.com/users/52402/rwc)
60133 silver badges77 bronze badges
[Add a comment](https://askubuntu.com/questions/124897/how-do-i-detach-a-screen-session-from-a-terminal "Use comments to ask for more information or suggest improvements. Avoid comments like “+1” or “thanks”.") \|
This answer is useful
11
Save this answer.
Show activity on this post.
> Create screen using this command: `screen -S testscreen`
> List the screen using this command: `screen -ls`
> Attache the screen using this command: `screen -r testscreen`
> Attache the multipurpose screen using this command (if already others are attached with the same screen): `screen -x testscreen`
> Detach the screen using this command: `screen -X detach` OR `Ctrl+a+d`
> Kill the screen using this command: `screen -XS testscreen kill`
> Terminate the attached screen using: `Ctrl+d`
[Share](https://askubuntu.com/a/1429444 "Short permalink to this answer")
Share a link to this answer
Copy link
[CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/ "The current license for this post: CC BY-SA 4.0")
[Improve this answer](https://askubuntu.com/posts/1429444/edit)
Follow
Follow this answer to receive notifications
answered Sep 15, 2022 at 6:14
[](https://askubuntu.com/users/745223/brijesh-sondarva)
[Brijesh Sondarva](https://askubuntu.com/users/745223/brijesh-sondarva)
35433 silver badges55 bronze badges
[Add a comment](https://askubuntu.com/questions/124897/how-do-i-detach-a-screen-session-from-a-terminal "Use comments to ask for more information or suggest improvements. Avoid comments like “+1” or “thanks”.") \|
This answer is useful
6
Save this answer.
Show activity on this post.
Some systems remove certain bindings by default. So it is best to look at the online keybinding page: `Ctrl-a ?`. You can also use the command prompt in `screen`: `Ctrl-a :detach`. Myself, I generally remove the key bindings for 'detach' and 'powerdetach', except on remote systems.
[Share](https://askubuntu.com/a/124911 "Short permalink to this answer")
Share a link to this answer
Copy link
[CC BY-SA 3.0](https://creativecommons.org/licenses/by-sa/3.0/ "The current license for this post: CC BY-SA 3.0")
[Improve this answer](https://askubuntu.com/posts/124911/edit)
Follow
Follow this answer to receive notifications
answered Apr 25, 2012 at 0:26
[](https://askubuntu.com/users/9449/arcege)
[Arcege](https://askubuntu.com/users/9449/arcege)
5,65822 gold badges1919 silver badges99 bronze badges
1
- "Some systems remove certain bindings by default" \<- worth the upvote\!
Matt Simerson
– [Matt Simerson](https://askubuntu.com/users/305980/matt-simerson "101 reputation")
2021-01-15 01:01:51 +00:00
[Commented Jan 15, 2021 at 1:01](https://askubuntu.com/questions/124897/how-do-i-detach-a-screen-session-from-a-terminal#comment2225488_124911)
[Add a comment](https://askubuntu.com/questions/124897/how-do-i-detach-a-screen-session-from-a-terminal "Use comments to ask for more information or suggest improvements. Avoid comments like “+1” or “thanks”.") \|
## You must [log in](https://askubuntu.com/users/login?ssrc=question_page&returnurl=https%3A%2F%2Faskubuntu.com%2Fquestions%2F124897) to answer this question.
**[Protected question](https://askubuntu.com/help/privileges/protect-questions)**. To answer this question, you need to have at least 10 reputation on this site (not counting the [association bonus](https://meta.stackexchange.com/questions/141648/what-is-the-association-bonus-and-how-does-it-work)). The reputation requirement helps protect this question from spam and non-answer activity.
Start asking to get answers
Find the answer to your question by asking.
[Ask question](https://askubuntu.com/questions/ask)
Explore related questions
- [command-line](https://askubuntu.com/questions/tagged/command-line "show questions tagged 'command-line'")
- [gnu-screen](https://askubuntu.com/questions/tagged/gnu-screen "show questions tagged 'gnu-screen'")
See similar questions with these tags.
- The Overflow Blog
- [He designed C++ to solve your code problems](https://stackoverflow.blog/2026/04/07/he-designed-c-to-solve-your-code-problems/?cb=1)
- Featured on Meta
- [Should the Community Bot stop bumping questions from EOL releases?](https://meta.askubuntu.com/questions/20776/should-the-community-bot-stop-bumping-questions-from-eol-releases?cb=1)
#### Linked
[3](https://askubuntu.com/questions/755649/can-i-re-open-a-terminal-session?lq=1 "Question score (upvotes - downvotes)")
[Can I re-open a terminal session?](https://askubuntu.com/questions/755649/can-i-re-open-a-terminal-session?noredirect=1&lq=1)
[2](https://askubuntu.com/questions/1097720/save-all-command-and-all-output-using-script-across-terminals?lq=1 "Question score (upvotes - downvotes)")
[Save all command and all output (using script across terminals)](https://askubuntu.com/questions/1097720/save-all-command-and-all-output-using-script-across-terminals?noredirect=1&lq=1)
[0](https://askubuntu.com/questions/740344/how-we-can-detach-from-screen?lq=1 "Question score (upvotes - downvotes)")
[How we can detach from screen?](https://askubuntu.com/questions/740344/how-we-can-detach-from-screen?noredirect=1&lq=1)
#### Related
[29](https://askubuntu.com/questions/62562/run-a-program-with-gnu-screen-and-immediately-detach-after?rq=1 "Question score (upvotes - downvotes)")
[Run a program with GNU screen and immediately detach after](https://askubuntu.com/questions/62562/run-a-program-with-gnu-screen-and-immediately-detach-after?rq=1)
[150](https://askubuntu.com/questions/302662/reattaching-to-an-existing-screen-session?rq=1 "Question score (upvotes - downvotes)")
[Reattaching to an existing screen session](https://askubuntu.com/questions/302662/reattaching-to-an-existing-screen-session?rq=1)
[1](https://askubuntu.com/questions/345904/attaching-to-a-service-in-screen?rq=1 "Question score (upvotes - downvotes)")
[Attaching to a service in screen](https://askubuntu.com/questions/345904/attaching-to-a-service-in-screen?rq=1)
[1](https://askubuntu.com/questions/716106/working-with-screen-sessions-in-lxd-managed-containers?rq=1 "Question score (upvotes - downvotes)")
[Working with screen sessions in LXD-managed containers](https://askubuntu.com/questions/716106/working-with-screen-sessions-in-lxd-managed-containers?rq=1)
[1](https://askubuntu.com/questions/809188/how-to-connect-to-a-private-screen-session?rq=1 "Question score (upvotes - downvotes)")
[How to connect to a "Private" screen session](https://askubuntu.com/questions/809188/how-to-connect-to-a-private-screen-session?rq=1)
[2](https://askubuntu.com/questions/842452/attach-detach-and-kill-a-process-in-screen-with-a-bash-script?rq=1 "Question score (upvotes - downvotes)")
[Attach, Detach and Kill a process in Screen with a bash script](https://askubuntu.com/questions/842452/attach-detach-and-kill-a-process-in-screen-with-a-bash-script?rq=1)
[0](https://askubuntu.com/questions/974330/how-to-start-detach-and-attach-x-applications-on-server?rq=1 "Question score (upvotes - downvotes)")
[How to start, detach and attach X applications on server](https://askubuntu.com/questions/974330/how-to-start-detach-and-attach-x-applications-on-server?rq=1)
[4](https://askubuntu.com/questions/983063/start-a-screen-session-and-run-a-script-without-attaching-to-it?rq=1 "Question score (upvotes - downvotes)")
[Start a screen session and run a script without attaching to it?](https://askubuntu.com/questions/983063/start-a-screen-session-and-run-a-script-without-attaching-to-it?rq=1)
[0](https://askubuntu.com/questions/1362858/how-to-create-an-sh-script-to-run-another-sh-script-with-screen-session-or-tmux?rq=1 "Question score (upvotes - downvotes)")
[How to create an sh script to run another sh script with Screen session or Tmux session](https://askubuntu.com/questions/1362858/how-to-create-an-sh-script-to-run-another-sh-script-with-screen-session-or-tmux?rq=1)
#### [Hot Network Questions](https://stackexchange.com/questions?tab=hot)
- [Is Dalinar a cognitive shadow?](https://scifi.stackexchange.com/questions/303960/is-dalinar-a-cognitive-shadow)
- [Hide only unused sockets (keep non-default values visible) in Geometry Nodes?](https://blender.stackexchange.com/questions/346100/hide-only-unused-sockets-keep-non-default-values-visible-in-geometry-nodes)
- [Solve the "49 lines"](https://puzzling.stackexchange.com/questions/137601/solve-the-49-lines)
- [How to remedy this thick gasket between drain and tub causing standing water?](https://diy.stackexchange.com/questions/329871/how-to-remedy-this-thick-gasket-between-drain-and-tub-causing-standing-water)
- [Is there a difference in meaning between 'el libro fue interesante' and 'el libro estuvo interesante'?](https://spanish.stackexchange.com/questions/45403/is-there-a-difference-in-meaning-between-el-libro-fue-interesante-and-el-libr)
- [How does 'everything is a file' not contradict 'do one thing and do it well'?](https://softwareengineering.stackexchange.com/questions/461068/how-does-everything-is-a-file-not-contradict-do-one-thing-and-do-it-well)
- [What type of foil should I use for a freezer evaporator cover?](https://diy.stackexchange.com/questions/329881/what-type-of-foil-should-i-use-for-a-freezer-evaporator-cover)
- [Diameter of the diophantine graph on positive integers (uv + 1 = □)](https://mathoverflow.net/questions/509929/diameter-of-the-diophantine-graph-on-positive-integers-uv-1)
- [Connected yet completely unrelated](https://puzzling.stackexchange.com/questions/137604/connected-yet-completely-unrelated)
- [Program which can create a task list](https://codereview.stackexchange.com/questions/301780/program-which-can-create-a-task-list)
- [Starting maths postdoc later than sooner](https://academia.stackexchange.com/questions/226426/starting-maths-postdoc-later-than-sooner)
- [Natural numbers as sums of powers of distinct numbers \#2](https://mathoverflow.net/questions/509953/natural-numbers-as-sums-of-powers-of-distinct-numbers-2)
- [What are some of the best mathematical visual demonstrators?](https://matheducators.stackexchange.com/questions/30133/what-are-some-of-the-best-mathematical-visual-demonstrators)
- [What's the mattress with Fridays?](https://literature.stackexchange.com/questions/31884/whats-the-mattress-with-fridays)
- [Looking for a fantasy book with a rude elf side character](https://scifi.stackexchange.com/questions/303943/looking-for-a-fantasy-book-with-a-rude-elf-side-character)
- [How to plot y = x^{2/3} + 0.8 cos(kx) √(3-x²) in LaTeX TikZ](https://tex.stackexchange.com/questions/761671/how-to-plot-y-x2-3-0-8-coskx-%E2%88%9A3-x%C2%B2-in-latex-tikz)
- [Function that searches a substring on an iterable, also with different types of return and ways to search](https://codereview.stackexchange.com/questions/301794/function-that-searches-a-substring-on-an-iterable-also-with-different-types-of)
- [How to move the Overpass Ultra window to where I am?](https://gis.stackexchange.com/questions/500488/how-to-move-the-overpass-ultra-window-to-where-i-am)
- [How stable is the difference between smooth and piecewise linear?](https://mathoverflow.net/questions/509951/how-stable-is-the-difference-between-smooth-and-piecewise-linear)
- [Isn't it unphysical for a moving observer to measure a different energy than a stationary observer?](https://physics.stackexchange.com/questions/871003/isnt-it-unphysical-for-a-moving-observer-to-measure-a-different-energy-than-a-s)
- [Turn a shark egg case into a tetrahedron](https://puzzling.stackexchange.com/questions/137596/turn-a-shark-egg-case-into-a-tetrahedron)
- [What do the hovering green/red buttons do?](https://gaming.stackexchange.com/questions/418357/what-do-the-hovering-green-red-buttons-do)
- [Communicating to colleagues from a different field](https://academia.stackexchange.com/questions/226413/communicating-to-colleagues-from-a-different-field)
- [Fantasy book about a prince who left and had some sort of way to show he was the real prince](https://scifi.stackexchange.com/questions/303968/fantasy-book-about-a-prince-who-left-and-had-some-sort-of-way-to-show-he-was-the)
[Question feed](https://askubuntu.com/feeds/question/124897 "Feed of this question and its answers")
# Subscribe to RSS
Question feed
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

# Why are you flagging this comment?
It contains harassment, bigotry or abuse.
This comment attacks a person or group. Learn more in our [Abusive behavior policy](https://askubuntu.com/conduct/abusive-behavior).
It's unfriendly or unkind.
This comment is rude or condescending. Learn more in our [Code of Conduct](https://askubuntu.com/conduct/abusive-behavior).
Not needed.
This comment is not relevant to the post.
```
```
Enter at least 6 characters
Something else.
A problem not listed above. Try to be as specific as possible.
```
```
Enter at least 6 characters
Flag comment
Cancel
You have 0 flags left today
# 
# Hang on, you can't upvote just yet.
You'll need to complete a few actions and gain 15 reputation points before being able to upvote. **Upvoting** indicates when questions and answers are useful. [What's reputation and how do I get it?](https://stackoverflow.com/help/whats-reputation)
Instead, you can save this post to reference later.
Save this post for later
Not now
##### [Ask Ubuntu](https://askubuntu.com/)
- [Tour](https://askubuntu.com/tour)
- [Help](https://askubuntu.com/help)
- [Chat](https://chat.stackexchange.com/?tab=site&host=askubuntu.com)
- [Contact](https://askubuntu.com/contact)
- [Feedback](https://meta.askubuntu.com/)
##### [Company](https://stackoverflow.co/)
- [Stack Overflow](https://stackoverflow.com/)
- [Stack Internal](https://stackoverflow.co/internal/)
- [Stack Data Licensing](https://stackoverflow.co/data-licensing/)
- [Stack Ads](https://stackoverflow.co/advertising/)
- [About](https://stackoverflow.co/)
- [Press](https://stackoverflow.co/company/press/)
- [Legal](https://stackoverflow.com/legal)
- [Privacy Policy](https://stackoverflow.com/legal/privacy-policy)
- [Terms of Service](https://stackoverflow.com/legal/terms-of-service/public)
- Cookie Settings
- [Cookie Policy](https://policies.stackoverflow.co/stack-overflow/cookie-policy)
##### [Stack Exchange Network](https://stackexchange.com/)
- [Technology](https://stackexchange.com/sites#technology)
- [Culture & recreation](https://stackexchange.com/sites#culturerecreation)
- [Life & arts](https://stackexchange.com/sites#lifearts)
- [Science](https://stackexchange.com/sites#science)
- [Professional](https://stackexchange.com/sites#professional)
- [Business](https://stackexchange.com/sites#business)
- [API](https://api.stackexchange.com/)
- [Data](https://data.stackexchange.com/)
- [Blog](https://stackoverflow.blog/?blb=1)
- [Facebook](https://www.facebook.com/officialstackoverflow/)
- [Twitter](https://twitter.com/stackoverflow)
- [LinkedIn](https://linkedin.com/company/stack-overflow)
- [Instagram](https://www.instagram.com/thestackoverflow)
Site design / logo © 2026 Stack Exchange Inc; user contributions licensed under [CC BY-SA](https://stackoverflow.com/help/licensing) . rev 2026.4.8.41838
Ubuntu and the circle of friends logo are trade marks of Canonical Limited and are used under licence. |
| Readable Markdown | This question shows research effort; it is useful and clear
251
Save this question.
Show activity on this post.
I know how to start a `screen`, and how to list different screens:
```
screen -ls
```
or to attach:
```
There are screens on:
2477.pts-0.server1 (Detached)
2522.pts-0.server1 (Detached)
2 Sockets in /var/run/screen/S-root.
$ screen -r 2477.pts-0.server1
```
But what is the key combination to detach from a screen session and keep it running?
[](https://askubuntu.com/users/158442/muru)
[muru](https://askubuntu.com/users/158442/muru)♦
209k58 gold badges520 silver badges794 bronze badges
asked Apr 24, 2012 at 22:48
[](https://askubuntu.com/users/26252/maniat1k)
This answer is useful
308
Save this answer.
Show activity on this post.
`Ctrl`\+`a` followed by `d`. Note the lower case. The \[[`screen` manpage](http://manpages.ubuntu.com/manpages/zesty/man1/screen.1.html)\] has a long list of these shortcuts under "DEFAULT KEY BINDINGS".
[](https://askubuntu.com/users/586957/max-bileschi)
answered Apr 24, 2012 at 23:02
[](https://askubuntu.com/users/56481/soren)
2
This answer is useful
80
Save this answer.
Show activity on this post.
To list your sessions, run:
```
screen -list
```
***
You can run any command under screen command like:
```
screen myscript.sh
```
Then press `Ctrl`\+`a` (release) and then `d` to detach the process/screen (so it'll continue to run).
***
To resume detached process, use:
```
screen -r
```
If you have multiple, then add the session number after that.
***
You can also re-attach to already `Attached` screen by `screen -x`. Useful to investigate why it's attached, share terminal with someone or to watch/check somebody what they're doing.
***
For more help, either run `man screen` or within the screen press `Ctrl`\+`a`, release and then hit `?` to see more shortcuts.
See also:
- [How to execute a command in screen and detach?](https://superuser.com/questions/454907/how-to-execute-a-command-in-screen-and-detach)
answered Oct 28, 2014 at 10:50
[](https://askubuntu.com/users/78223/kenorb)
This answer is useful
16
Save this answer.
Show activity on this post.
You'll probably see it listed like this in the screen man page:
```
^a - d
```
It's important the note the case of the letters as uppercase and lowercase will do different functions.
answered Apr 25, 2012 at 0:01
[](https://askubuntu.com/users/52402/rwc)
This answer is useful
11
Save this answer.
Show activity on this post.
> Create screen using this command: `screen -S testscreen`
> List the screen using this command: `screen -ls`
> Attache the screen using this command: `screen -r testscreen`
> Attache the multipurpose screen using this command (if already others are attached with the same screen): `screen -x testscreen`
> Detach the screen using this command: `screen -X detach` OR `Ctrl+a+d`
> Kill the screen using this command: `screen -XS testscreen kill`
> Terminate the attached screen using: `Ctrl+d`
answered Sep 15, 2022 at 6:14
[](https://askubuntu.com/users/745223/brijesh-sondarva)
This answer is useful
6
Save this answer.
Show activity on this post.
Some systems remove certain bindings by default. So it is best to look at the online keybinding page: `Ctrl-a ?`. You can also use the command prompt in `screen`: `Ctrl-a :detach`. Myself, I generally remove the key bindings for 'detach' and 'powerdetach', except on remote systems.
answered Apr 25, 2012 at 0:26
[](https://askubuntu.com/users/9449/arcege)
1
## You must [log in](https://askubuntu.com/users/login?ssrc=question_page&returnurl=https%3A%2F%2Faskubuntu.com%2Fquestions%2F124897) to answer this question.
Start asking to get answers
Find the answer to your question by asking.
[Ask question](https://askubuntu.com/questions/ask)
Explore related questions
See similar questions with these tags. |
| Shard | 53 (laksa) |
| Root Hash | 9277990770814737653 |
| Unparsed URL | com,askubuntu!/questions/124897/how-do-i-detach-a-screen-session-from-a-terminal s443 |