Why You Should Try tmux Instead of screen
dominik.honnef.co
dominik.honnef.co
In the end (rather quickly actually) I went back to screen. It's simple. It works. It's reliable, mature and stable. It has the "proper" keybindings which has been around for decades for this kind of software.
Whatever tmux was supposed to provide of additional value I could not find.
Edit: I see that this article (from 2010) says screen doesn't have a menu to select buffers. That's factually incorrect. That feature must have been there already before tmux was started?
So, to get the same usability as in screen, one is forced to add things like these:
bind-key C-i last-window
bind-key C-n next-window
bind-key C-p previous-window
bind-key C-c new-window
Otherwise, it takes longer to activate (use) the bindings.Before anyone asks, I've added suggested config which should have been a remedy, but none of the following restores screen's quick binding access:
unbind C-i
set -g prefix C-i
bind-key C-i send-prefix # Set escape character to Shift-Ctrl-^ and meta character to ^
escape ^^^
# Get rid of stupid visual bell wait.
vbellwait 0
vbell_msg ^G
bell_msg ^G
# Status line.
hardstatus on
hardstatus alwayslastline
hardstatus string "%H|%w%=|%d/%m %c"Are you sure?
Could it be the author just wanted a BSD licensed screen alternative or some other reason(s)?
"The keybindings are different" argument seems quite silly since you can easily change them to whatever you want. It's like when people say they will not use Lua because indices start at 1 instead of 0.
tmux may be thought of as an alternative, not a replacement.
Whether that's correct is an open question.
Example: If I start a build world in a screen window, then detach and later I want to get a "screen shot" or "screen grab" of the output without re-attaching, how do I do that?
Also, tmux's "clipboard buffer(s)", e.g., tmux loadb, tmux lsb, etc., seems a little more versatile than screen, but I'm open to suggestions from screen users how to do these things in screen.
Here's what I use in tmux for the Example:
cat tt
case $1 in
""|-b|-E|-S|-t)
tmux capturep $@
exec tmux showb $@
;;
*)exit
esac(find-window) is major feature for me (91 windows currently). That and no more "Suddenly the Dungeon collapses!! - You die..." :)
Copy mode allows you to select and copy text using vi or emacs ( whatever you choose ) key bindings. This way, you can go completely mouse free in the terminal. This is also present in screen.
Then scriptability: tmux exposes lots of commands so you can interact with it from a script. There are quite a few plugins out there. https://github.com/tmux-plugins/
My personal favourites:
- https://github.com/morantron/tmux-fingers/ copy pasting using vimium-like hints, so you don't even have to enter copy mode ( this one I did it myself </shameless-plug> )
- https://github.com/tmuxinator/tmuxinator/ predefined user sessions. Solves repetitively opening the same services/commands every time you start a coding session.
Only gripe I have with it is that copy-paste can be fiddly, but that's terminals for you.
http://dominik.honnef.co/posts/2010/10/why_you_should_try_tm...
Tmux is great, but only after customizing it and making it your own, and this can take a fair bit of time. If you find yourself shelling into remote servers you don't control, or want to use it on Windows prior to Windows 10, then screen is probably a better choice. While tmux could be used on windows through cygwin, I never found it to be stable enough for day to day use.
Instead it should either leave the environment as it, or create clean login shells.
I personally use screen, because it's what I learnt years & years ago. I also like that sometimes it's there by default when I login to a new server.
...but most linux "power users" prefer tmux.
I only once had a need (easy copy paste in terminal) to get tmux running on a server with no SSH, so I installed it.
For all other machines, which do not have tmux installed I use my local machine and SSH/MOSH with my local tmux. If there is a need to have a long running command on a server, I use tmux to detach the session, fallback to screen for detaching, fallback to SSH nohub
That's what I'd do, if a server doesn't have screen/vim and sysadmins are being a nuisance.
So when I SSH into a box, I pretty much have my "full" toolset just as I would locally. For me, this is important.
That coupled with the fact I have my vimrc memorized, I'm pretty much good on all modern servers.
It has the most useful feature of all: a rotating 3D cube.
it can use either as a backend, and makes them better IMHO. YMMV.
Why I switched back to screen:
1. It's more commonly installed. Not a big deal these days, but still.
2. It's really easy to resize a window to fit whatever terminal window I'm using: C-a F. As far as I could find, there is no way to do this with tmux.
Nice.
Uses UDP/protobuffs so network connection can be lost/changed/etc.
You know, from a practical point of view.
Look at 'tmux -CC', it's really great.
Not sure if there is something similar for screen.