![]() |
(on Wikipedia)
https://www.gnu.org/software/screen/
A terminal multiplexer
I use it only in fairly dire circumstances, usually when at the TTY console. It's essential in that circumstance, even if it's only to lock the console screen (with ^a^x
)
-
aka GNU Screen
--
- 2017-11-26 - 4.02.01 (GNU) 28-Apr-14 on Devuan-1.0.0-jessie-i386-DVD
- 2017-11-26 - 4.01.00devel (GNU) 2-May-06 on 3.10.0-714.10.2.lve1.4.63.el7.x86_64
- 2016-03-28 - 4.00.03 (FAU) 23-Oct-06 on Slackware 14.1
- 2016-03-26 - 4.01.00devel on Lubuntu 14.04.4 LTS
-
2006-06-11 - 3.09.15 (FAU) 13-Mar-03 on (distribution not recorded)
Magical su screen ∞
- Begin root-screen if it does not already exist.
- Enter into that root-screen.
- Take over any existing instance of screen.
- Force-logout existing "screen sessions", and close any terminals with a root-screen.
-
Remember the current directory, and create a new "window" within that root-screen, placed at that directory.
su() { \sudo \screen -X setenv currentdir `pwd` \sudo \screen -X eval 'chdir $currentdir' screen \sudo \screen -A -D -RR }
2006-06-11 - 3.09.15 (FAU) 13-Mar-03 ∞
- I don't know how to launch screen automatically when I log in.
screen -q
to not display that damned splash screen.-
screen -h <lines>
for the scrollback buffer. Yay.- Or add
defscrollback 10000
in~/.screenrc
- Or add
-
Is it possible to redefine the hotkeys?
- Can I bind hotkeys through KDE to redefine what certain keys do?
-l
will force a login.. but it doesn't seem to work. =/-
^
orC-
meancontrol
-e xy specifies the command character to be x and the character generat‐ ing a literal command character to y (when typed after the command character). The default is "C-a" and ‘a', which can be specified as "-e^Aa". When creating a screen session, this option sets the default command character. In a multiuser session all users added will start off with this command character. But when attaching to an already running session, this option changes only the command character of the attaching user. This option is equivalent to either the commands "defescape" or "escape" respectively.
Usage ∞
Tips ∞
- Basic Commands:
^
means "control
"
^a^c
-- Open a new sub-screen session^a^n
-- Next screen^a^p
-- Previous screen-
^a?
-- Help
- Advanced Commands:
^a^a
-- Last viewed screen-
^a^d
-- Disconnect session. This leaves it running in the background.\screen -list
will display the disconnected sessions.\screen -D -RR
will reconnect with all disconnected sessions.
^a<enter>
or^a_
-- monitor silence.^aA
-- Name the current window-
^a"
-- list/select sessions
My commandline preference is:
\screen -a -D -R -q -T term -h 1000 -x
This will merge all sessions into one single place. It's a Bad Idea™ if you need to view multiple consoles next to one another in a graphical environment. But it's awesome otherwise.
You could specify this in your ~/.bashrc
quite easily. Or you could have a nice hotkey in your GUI which does something like:
xterm -e screen -a -D -R -q -T term -h 1000 -x
.. but this doesn't really work.. the first occurrence explodes, and ^a^c
explodes.
Configuration ∞
~/.screenrc
See also my .screenrc.
Scrollback ∞
termcapinfo xterm* ti@:te@ scrollback 1000
Customized xterm title ∞
(xterm)
hardstatus on hardstatus string "[%?%h%:%t%?]" defhstatus ""
Have titles like [pine] -- screen's name
if no title of window or [host:/path] (from my shell prompt which sets the title)
With the following line, propagate the hardstatus/title to get one []
for each nesting of screen.
termcapinfo xterm|screen 'hs:ts=\E]2;:fs=\007:ds=\E]0;screen\007'
Status Bar ∞
A bar on the bottom containing the time, window number and name, and title if any... and the hostname on the right side.
caption always caption string "%{=bc}[%{w}%0c%{c}][%{w}%n:%t%{c}]%?[%{w}%{+i}%h%{c}]%?%{w}%=%H"
https://www.gilesorr.com/blog/screen-status-bar.html has more
Also check out:
hardstatus alwayslastline "%{= dd}%-w%{+b}%n %t%{-}%+w %=%{= dW}%h%{-}%20`%10`"
Troubleshooting ∞
- log in as one user, start
screen
-
start another bash session, log in as
root
, startscreen
You are not the owner of /home/USERNAME/.screen.
Instead of just su
do su -
Screen resources ∞
- https://web.archive.org/web/20040610164217/http://www.kuro5hin.org/story/2004/3/9/16838/14935
- https://web.archive.org/web/20040413122536/http://jmcpherson.org/screen.html
-
https://web.archive.org/web/20051001031421/http://gentoo-wiki.com/TIP_Using_screen
Alternatives ∞
See /tag/terminal-multiplexers
- If you just want to have the functionality to abstract the controlling terminal from the application, check out dtach.
- If you just want tabs for your X-terminals, then check out mrxvt (aka materm).
-
If you are on Windows Subsystem for Linux, then also check out XLaunch and you can run X-terminals
Last updated 2021-02-19 at 10:16:44
ported
found older notes. Pushing it back from 2015-05-10 to 2006-06-11 though I had known about it earlier.
Holy crap, I finally fixed scrollback.