Hacker News new | past | comments | ask | show | jobs | submit login
Why You Should Try tmux Instead of screen (honnef.co)
91 points by andrewfromx on July 3, 2016 | hide | past | web | favorite | 57 comments

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?

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:

    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

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"

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.

Yes, I've always found tmux to be a bit weird, especially its hijacking of mouse events which really throws me.

I also use screen, but once when I wanted to automate something I found out that tmux was easier to script.

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"

"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
   tmux capturep $@ 
   exec tmux showb $@ 

Add `dvtm' inside `screen' session to your toolbelt. Splits your terminal into few other terminals you can arrange in several ways.

Is there additional functionality over native screen (or tmux) capabilities that appear to do the same thing?

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).

Correction: screen is terrible on the ground of splitting terminal in several pieces. dvtm fills this space elegantly.

There is another tool by the author of dvtm called abduco which provides session management features


> Whatever tmux was supposed to provide of additional value I could not find.

(find-window) is major feature for me (91 windows currently). That and no more "Suddenly the Dungeon collapses!! - You die..." :)

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.

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> )

- https://github.com/tmuxinator/tmuxinator/ predefined user sessions. Solves repetitively opening the same services/commands every time you start a coding session.

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.

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.

Why is tmux better?

Here's an article explaining how tmux is better:


That's an interesting article, but do you have a pointer to any discussion of it?

Here's a discussion about such an article:


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.

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".

[0] https://wiki.archlinux.org/index.php/tmux

Pick one and use it.

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.

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

cheatmode is have a local statically compiled version of tmux ready to godmode servers you can SCP files to (all of em, if you've got ssh most likely)

That's what I'd do, if a server doesn't have screen/vim and sysadmins are being a nuisance.

Unfortunately, the most recent tmux will not build statically.


I keep a pretty sparse toolset. vim+screen and always use them together even on my laptop.

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.

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.

Don't forget neercs!

It has the most useful feature of all: a rotating 3D cube.

Somehow that seems even less useful than sl(1).


it can use either as a backend, and makes them better IMHO. YMMV.

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.

>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.


Tmux supports this as well, just use "tmux new-session -t xy" instead of "tmux attach-session -t xy".

The last time I used screen it didn't allow you to split windows vertically. This was 2-3 years ago. Is that still true?

Some distributions were using patched versions before, but from 17 Apr 2014 - screen 4.2.0 and further have it. Shortcut is: C - a |

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

ctrl-a | is there from long more than 3 years, in the manual page for those willing to read it.

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.

Tmux - the config is so much easier to understand and shortcuts as well

Why would one prefer tmux or screen over multiple ssh sessions on a nice tabbed terminal program like iTerm2 ?

Because if your network drops the connections, you can resume with tmux or screen, but not with vanilla ssh.

This is solved with mosh: https://mosh.mit.edu

Uses UDP/protobuffs so network connection can be lost/changed/etc.

And since almost nobody uses mosh (and let's not talk about security implications of its implementation), problem is not really solved at all.

You know, from a practical point of view.

Not sure if you're aware but iterm2 (v3) has tmux support so you can have the benefits of both.

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).

Look at 'tmux -CC', it's really great.

I use a jump-server, so I can ssh in, and connect to an existing tmux session. If I handled my terminals locally, I wouldn't be able to do that.

There's also tmate which makes it easy to share a tmux session over ssh.

Not sure if there is something similar for screen.

If someone's looking for a third option: combine abduco with dvtm.

Woah, tiling window management for the console! That is so awsesome. Thank you, good sir.

Applications are open for YC Winter 2020

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact