>When several clients are attached to the same session, each client can watch a different window. When clients are watching different windows, every client uses the full terminal size.
I've been using tmux for years now, and the last time I had to use screen (because it was the only thing pre-installed on a server) it felt like going back to the Dark Ages.
Only gripe I have with it is that copy-paste can be fiddly, but that's terminals for you.
exactly what I thought. Screen is there by default always and tmux would have to be installed sometimes. So maybe I should pick screen even though tmux is more modern and better? Tough choice really. I could see myself on some server someday without the time/option to install tmux and trying to learn screen in 5 mins.
I use vim to be prepared for a new server, but do not stay with screen to be prepared.
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
This is the approach I adopt as well. Customization is nice, but the basic tools offer a lot of functionality if you choose to learn and more so adopt them. Vim tiny some distros ship can be a problem though.
I'm not a heavy user, but I recently moved from screen to tmux. I initially chose screen because it is installed by default practically everywhere. But tmux is better, so, my take is this: choose tmux unless you'll need to work on servers where you can't get tmux installed.
I've been using tmux for a while. What I like most is the copy mode and its scriptability.
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> )
Why would you prefer multiple ssh sessions over a single ssh session and tmux with iTerm2, which will let you keep the tabs (and when you make a new tab, automatically make it a remote connection).
I've used screen for years and years and because of the noise around tmux, I decided to try to give it a spin.
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?
I don't know, I've never bothered to read tmux' docs. As I hear from colleagues, there's none, apart from more friendly learning curve (dvtm doesn't try to handle sessions).
All you are really saying is "I am used to screen's behavior and keybindings". That is fine, but it doesn't delete the huge amount of useful functionality in tmux that is not in screen. Nor does it make screen "simple" or "mature". Screen is old, not mature. It is fragile and brittle and clunky and inconsistent. Which is not surprising given its age and lack of active maintainers.
An annoying thing about screen is the default settings are pretty terrible. I use the following $HOME/.screenrc on all my machines which improves things a bit:
# 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"
One problem with tmux is that you have to add extra bindings for each keybinding which you want to use like in screen where you do not have to lift your finger before pressing the last part.
So, to get the same usability as in screen, one is forced to add things like these:
screen has been far too buggy for me. Especially when my connection dropped and I wanted to reattach to an existing session. Sometimes it just froze there, even by forcing the detach.
"tmux was supposed to provide [of] additional value"
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
I use tmux constantly. But if you are happy with screen, I don't see any reason to switch. I hate articles that say "you should use $new_tool instead!" when they should be "Here's why I like $new_tool better than $old_tool"
One thing I found tmux surprising for is how it inherits environment variables from the parent process and then loads the profile on top. This makes the resulting environment unusual.
Instead it should either leave the environment as it, or create clean login shells.
I thought the default was to create a login shell? See the "Start a non-login shell" section on the Arch Wiki[0]. I turn that off with the option mentioned there: that way it inherits from my current environment - I probably misunderstand what you mean by "inherit" versus "leave the environment as is".
I started with screen, but moved to tmux around 5 years ago. For me, the sell was in custom layouts, and the no nonsense screen splitting. I usually work on several different project types, and have a scripted layout for each the of project types. This makes getting started in the morning instant.
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.
I usually use screen in a very vanilla way (i.e. logged into some rhel box I didn't build or configure) and in my experience you still cannot split vertically. x_x
Unfortunately for me most of the applications I have access to (and want to have installed) do not have custom patches including functionality like that. I'm left with C-a S as my only native option.
I was using tmux for a while after years of using screen. At least for my use case, the main thing I liked better about tmux was that windows (or whatever the proper term is) get their names updated based on the command running. In screen, I would have to manually change the name (maybe there is a way around this but I was always too lazy to find out).
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.
57 comments
[ 3.4 ms ] story [ 40.0 ms ] threadit can use either as a backend, and makes them better IMHO. YMMV.
Nice.
Only gripe I have with it is that copy-paste can be fiddly, but that's terminals for you.
It has the most useful feature of all: a rotating 3D cube.
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.
http://dominik.honnef.co/posts/2010/10/why_you_should_try_tm...
https://news.ycombinator.com/item?id=12024794
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.
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.
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?
http://www.brain-dump.org/projects/abduco/
So, to get the same usability as in screen, one is forced to add things like these:
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:
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:
(find-window) is major feature for me (91 windows currently). That and no more "Suddenly the Dungeon collapses!! - You die..." :)
Instead it should either leave the environment as it, or create clean login shells.
[0] https://wiki.archlinux.org/index.php/tmux
Not sure if there is something similar for screen.
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.
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.