Which are you using?
Why use either?
Terminal multiplexing
Useful features…
- Multiple terminals in one
- Keyboarding only
- Detaching & reattaching
- Server-side scrollback
- Alert to changes in other windows
And also…
- Cope with flaky links
- Share terminal with other people
- Terminal logging
- Configurable status line
Ops war story
Shared windows during migration:
- root shell
- tail -F /var/log/{maillog,secure,messages,httpd/*log}
- tail -F /var/log/audit/audit.log | grep ^type=AVC
- psql session
- rsync run window
- migration steps and notes in Vim
- others ad-hoc as needed
Pair programming
Combine shared Screen or tmux with
headset & phone, Skype, Google+ Hangout
Screen the venerable
Not really broken, but stagnant.
Enter tmux
Pros:
- More unique name, easier for searches :)
- Faster screen drawing
- Far less memory usage:
100 windows in Screen = 370 MiB resident
100 windows in tmux = 5 MiB resident
More pros
- Window names update to show command run
- More than 100 windows possible by default.
Modern screen limits to 100, once was limited to 40
- Better support for panes
- Status bar comes by default, easier to configure
Even more pros
- vi keybindings for commands; can switch to emacs, while
screen uses only emacs keybindings
- Switch to a window by text search: meta f
- meta w to show windows goes up to 36 with single char
(0-9, a-z) whereas screen only does 0-9
More more
- individually detachable and reattachable windows
- easier “follow the leader”
More more pros
- Under active development
- Most people say it’s cleaner code
- Should keep progressing
synchronize-panes
^B "
^B :setw synchronize-panes on
“Follow the leader”
^B :lock-client
Copy history and paste
Broken on various platforms…
^B [
vi keybindings to move, search, etc.
space starts copying; enter when done
^B # to see history of buffers
Consistency
q dismisses:
- dialogs
- scrollback navigation
cwd
Screen keeps cwd same in all new windows.
tmux keeps cwd same as last window when opening new.
My bias
Screen since 2005 at least?
tmux since 21 June 2011.
Cons
- control-left & control-right broken
- ^B default pain to type
- ^B is used for page-back in vi
- ^B l is a pain vs. Screen’s ^A ^A
- ^A F missing?
Common command changes
- A → , (retitle window)
- " → w (show buffers)
- ^A → l (last window seen)
- K → & (kill window, or x for pane)
Invocation options
- screen -l → tmux list-clients → tmux ls
- screen -x $name → tmux attach-session -t $name → tmux att
- screen -S $name → tmux new -s $name
Screen within a screen
Or screens within tmux.
Scrollback history too small
- tmux: history-limit 2000
- Screen: defscrollback 100
Set to 100000 or so in /etc/screenrc or ~/.tmux.conf.
Peaceful cop-out
Learn them both so you can:
- work together with people who use the other
- cope with one not being installed
Learn default keybindings
Customization is nice, but know the defaults!
Just try it
If you haven’t tried them yet, do it today!
Must use them to understand and learn.
Availability
Screen: everywhere, often preinstalled
tmux: recent Debian, Ubuntu, RHEL 5+ (EPEL),
Fedora, FreeBSD. Ships with OpenBSD.
Group demo
ssh demo@utosc.temphost.net
pass: verysecure
screen -x
tmux att