ℹ️ 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 | 2.7 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://maxchadwick.xyz/blog/linux-screen-cheatsheet |
| Last Crawled | 2026-01-14 22:42:51 (2 months ago) |
| First Indexed | 2018-04-28 23:57:27 (7 years ago) |
| HTTP Status Code | 200 |
| Meta Title | Linux Screen Cheatsheet | Max Chadwick |
| Meta Description | A quick reference of useful commands for interacting with the Linux screen utility, |
| Meta Canonical | null |
| Boilerpipe Text | Published: April 25, 2018
There are a few of these, but none have all the answers that I want (e.g. how to scroll back up the terminal while attached to a screen session) or are in a format I like. So, I’ve prepared my own.
This is a cheatsheet of how to do the things I typically need to do with Linux (unix)’s
screen
command…
Start A New Screen Session
$ screen -S [name]
Name is just an alias for the screen session so that it can easily be distinguished what’s happening in that session when looking at a list of all screen sessions via
screen -ls
.
Detach From The Current Screen Session
ctrl-a d
In order to detach from a screen session hold the control key and press “a”. Then press the “d” key.
You’ll be back a command prompt like the below after doing so.
[detached from 28882.db-dump]
$
List Running Screen Sessions
$ screen -ls
As mentioned above
screen -ls
will list running screen sessions. Here’s a sample of the output
$ screen -ls
There are screens on:
28882.db-dump (Detached)
46174.mw-scan (Detached)
2 Sockets in /var/run/screen/S-mchadwick.
Re-attach to a Screen Session
screen -r [name-or-pid]
screen -r
will allow you to re-attach to a running screen session. You can use the id or name of the screen session.
Scroll up while attached to a screen session
ctrl-a esc
While attached to a screen session, hold the control key and press “a”. Then press escape. At this point you’ll be able to scroll up and down within the screen session.
Press escape again to regain the ability to enter commands.
Kill the screen session you’re currently attached to
ctrl-a k
While attached to a screen session, hold the control key and press “a”, then press “k”. You’ll need to then press “y” to confirm you’d really like to kill the screen session.
Detach a screen from another terminal and attach to it
$ screen -d -r [name]
You may have to do this if you unexpectedly lost an SSH connection while attached to a screen session. In this case the
screen
session may still think it’s connected to that SSH connection (e.g. orphaned). The above command will detach it from that terminal and re-attach it to the current terminal. |
| Markdown | - [Home](https://maxchadwick.xyz/)
- [Blog](https://maxchadwick.xyz/blog/)
- [Talks](https://maxchadwick.xyz/talks)
- [Projects](https://maxchadwick.xyz/projects)
# Linux Screen Cheatsheet
#### Published: April 25, 2018
**Tags:**
- [Shell](https://maxchadwick.xyz/tags/#shell)
- [Tools](https://maxchadwick.xyz/tags/#tools)
 [Improve this page on GitHub](https://github.com/mpchadwick/mpchadwick.github.io/edit/master/_posts/2018-04-25-linux-screen-cheatsheet.md)
There are a few of these, but none have all the answers that I want (e.g. how to scroll back up the terminal while attached to a screen session) or are in a format I like. So, I’ve prepared my own.
This is a cheatsheet of how to do the things I typically need to do with Linux (unix)’s `screen` command…
### Start A New Screen Session
```
$ screen -S [name]
```
Name is just an alias for the screen session so that it can easily be distinguished what’s happening in that session when looking at a list of all screen sessions via `screen -ls`.
### Detach From The Current Screen Session
**ctrl-a d**
In order to detach from a screen session hold the control key and press “a”. Then press the “d” key.
You’ll be back a command prompt like the below after doing so.
```
[detached from 28882.db-dump]
$
```
### List Running Screen Sessions
```
$ screen -ls
```
As mentioned above `screen -ls` will list running screen sessions. Here’s a sample of the output
```
$ screen -ls
There are screens on:
28882.db-dump (Detached)
46174.mw-scan (Detached)
2 Sockets in /var/run/screen/S-mchadwick.
```
### Re-attach to a Screen Session
```
screen -r [name-or-pid]
```
`screen -r` will allow you to re-attach to a running screen session. You can use the id or name of the screen session.
### Scroll up while attached to a screen session
**ctrl-a esc**
While attached to a screen session, hold the control key and press “a”. Then press escape. At this point you’ll be able to scroll up and down within the screen session.
Press escape again to regain the ability to enter commands.
### Kill the screen session you’re currently attached to
**ctrl-a k**
While attached to a screen session, hold the control key and press “a”, then press “k”. You’ll need to then press “y” to confirm you’d really like to kill the screen session.
### Detach a screen from another terminal and attach to it
```
$ screen -d -r [name]
```
You may have to do this if you unexpectedly lost an SSH connection while attached to a screen session. In this case the `screen` session may still think it’s connected to that SSH connection (e.g. orphaned). The above command will detach it from that terminal and re-attach it to the current terminal.
 **Hi, I'm Max\!**
I'm a software developer who mainly works in [PHP](https://maxchadwick.xyz/tags/#php), but loves dabbling in other languages like [Go](https://maxchadwick.xyz/tags/#go) and [Ruby](https://maxchadwick.xyz/tags/#ruby). Technical topics that interest me are [monitoring](https://maxchadwick.xyz/tags/#monitoring), [security](https://maxchadwick.xyz/tags/#security) and [performance](https://maxchadwick.xyz/tags/#performance). I'm also a stickler for good documentation and clear technical writing.
During the day I lead a team of developers and solve challenging technical problems at [Rightpoint](https://www.rightpoint.com/) where I mainly work with the [Magento](https://maxchadwick.xyz/tags/#magento) platform. I've also [spoken](https://maxchadwick.xyz/talks) at a number of events.
In my spare time I [blog about tech](https://maxchadwick.xyz/blog), [work on open source](https://github.com/mpchadwick) and [participate in bug bounty programs](https://bugcrowd.com/mpchadwick).
If you'd like to get in contact, you can find me on [Twitter](https://twitter.com/maxpchadwick) and [LinkedIn](https://www.linkedin.com/in/mpchadwick/).
Load comments
Please enable JavaScript to view the [comments powered by Disqus.](https://disqus.com/?ref_noscript)
The entire source of this site is [available on Github](https://github.com/mpchadwick/mpchadwick.github.io).
If there's a specific topic you're looking to read about try [searching](https://maxchadwick.xyz/search) or [browsing by tag](https://maxchadwick.xyz/tags/).
- [GitHub](https://github.com/mpchadwick)
- [Twitter](https://twitter.com/maxpchadwick)
- [LinkedIn](https://www.linkedin.com/in/mpchadwick)
- [RSS](https://maxchadwick.xyz/feed.xml)
**© 2025 Max Chadwick** |
| Readable Markdown | null |
| Shard | 181 (laksa) |
| Root Hash | 3060307996292955781 |
| Unparsed URL | xyz,maxchadwick!/blog/linux-screen-cheatsheet s443 |