Screen - howto
- Install screen
- Set some usefull preferences
- Start your first screen session
- Detach from the running screen session
- Reconnect to the running screen session
- Create another screen
- Toggle between the two screens
- Assign a name to the currently active screen
- Pull up a list of all running screens
- Scrolling up/down in a screen
- How do you close a screen?
- Quick toggle between two screens
- Fixing a screen that seems locked
- How to list running screens
- Shared screens
- Screwed up screens
- Getting help on commands
- Changelog
1. Install screen
root# emerge screen
2. Set some usefull preferences
# Use visual bell
vbell on
# Set a big scrolling buffer
defscrollback 5000
# Set the caption on the bottom line
caption always "%{= kw}%-w%{= BW}%n %t%{-}%+w %-= @%H - %LD %d %LM - %c"
# Support UTF-8
defutf8 on
# Don't show the slash screen
startup_message off
3. Start your first screen session
user# screen
Now open a program you want to be able to disconnect and connect to:
user# irssi
4. Detach from the running screen session
At this point you will return to your shell prompt, but irssi is still running in the background, pretty neat!
5. Reconnect to the running screen session
user# screen -r -d
6. Create another screen
Type: ctrl+a c to create it. Now you should see a shell prompt again, try doing:
user# top
which will open up the performance monitor in this screen.
7. Toggle between the two screens
- Use ctrl+a n to go next, and ctrl+a p to go previous.
- You can also specify the screen name by number like this: ctrl+a 1 to toggle to "top" and ctrl+a 0 to toggle to "irssi".
8. Assign a name to the currently active screen
9. Pull up a list of all running screens
10. Scrolling up/down in a screen
11. How do you close a screen?
12. Quick toggle between two screens
13. Fixing a screen that seems locked
The fix is to hit ctrl+a q
14. How to list running screens
screen -ls
Unfortunately this doesn't show screens of other users. The only
way I [currently] know how to do this is to look using
ps:
ps -ef | grep SCREEN
15. Shared screens
root# chmod u+s /usr/bin/screen
root# chmod go-w /var/run/screen
Start a screen session:
user# screen Then do (where guest
is the userid of the person who's going to connect to the shared
session, and owner is the userid of the
person creating the shared session, aka the person who owns the
computer):
ctrl+a :multiuser on #Enable shared sessions
ctrl+a :acladd guest #Give rights to guest
ctrl+a :aclchg guest -x "?" #Revoke permission to execute commands
Then the other user will ssh to the box, and execute:
user# screen -x owner/
to join my session
When you're finished with the session, clean things up by exiting the screen session, and do:
root# chmod u-s /usr/bin/screen
root# chmod 775 /var/run/screen
16. Screwed up screens
"If you accidentally freeze screen (usually this happens if you hit ctrl+s or ctrl+a s you can fix it by hitting ctrl+q or ctrl+a q. Another way to potentially break screen is if you it the pause/break button while using putty or ctrl+z, then you simply need to type fg at the command line to bring your irssi session back. The fg trick also works should you manage to make anything else in screen dissappear with ctrl+z or pause/break."
17. Getting help on commands
| Changelog: Date | Description |
|---|---|
| 10/05/2005 @ 01:00 | Initial creation |
| 10/30/2005 @ 16:00 | Added initial info on shared screens |
| 10/02/2006 @ 15:32 | Added .screenrc file, replaced ctrl+a with ctrl+o |
| 02/20/2007 @ 20:36 | Added info on copy mode, link to Gentoo wiki |
| 07/20/2008 @ 23:29 | Switch back to ctrl+a (I'm no longer an emacs user) |
| 07/22/2008 @ 23:59 | Add link to lizzie.spod.cx (not sure how I missed that), and clean up a few things |
This document was originally created on 10/5/2005
Disclaimer:
This page is not endorsed by gentoo.org or any other cool
cats. Any information provided in this document is to be used
at your own risk.