2010-07-19

Three-way mini shootout between GNU screen, tmux and dtach+dvtm

When it comes to terminal managers in Linux, it usually boils down to three choices: screen, tmux or the dtach+dvtm duo. Proponents of each often vigorously tout their solution as the best. So let's see how they compare.

The Contenders

  • GNU screen is the oldest and perhaps most widely used of the terminal managers in this comparison. It has been around since the 1980s and made thousands if not millons of users' lives easier since then.
  • tmux is a relative newcomer, the first release dating to late 2007. It was developed specifically with the goal of overcoming limitations in the implementation of screen.
  • dvtm is best described as tiling window manager for the console. First released in late 2007 too, it lacks the disconnection/reattachment feature of the other two solutions, so it will unleash its full power only in combination with dtach which does exactly that. (Using screen/tmux with dvtm is also possible.) dtach was released in 2004.

The Parcours

The contenders will have to show how they perform in the aspects that matter to the modern geek. This includes mind share, adherence to Unix philosophy, features, efficient use of resources and ease of use.

Mind share

GNU screen has been around longest, so has had more time to capture users. Measuring popularity using Google is a bit difficult, as searching for "GNU screen" (with the quotes) will probably under-report while searching for "screen" will over-report actual numbers. A Google Trends analysis omitting the quotes sees screen in front, with tmux a distant second. This more or less matches the Debian Popularity Contest, which currently clocks screen at position #756, tmux at #6159 and dtach/dvtm at #6242 and #8604 respectively.
Winner: screen

Unix Philosophy

The Unix tools were developed with several precepts in mind, an important one being "Make each program do (exactly) one thing well". In this tradition, dvtm tried not to include everything but the kitchen sink, but instead leaves the disconnection/reattachment function to dtach, and displays auxiliary data such as the status bar and clock via named pipes.
screen and tmux on the other hand integrate all functions in one large binary.
Winner: dtach+dvtm

Features

Besides the ability to open several shells in one terminal/console, all contenders have a scrollback buffer, can do copy and paste and display status information. Both dvtm and tmux have mouse support and are able to align multiple shells nicely, not like in screen's limited fashion. Its client/server model allows tmux however to provide one notable feature, sending/sharing sessions between different connected clients. [Update: A commenter alerts me to the fact that screen can do this too. Still, tmux has more features.]
Winner: tmux

Efficient use of resources

In the time that screen has been around, it was able to accumulate a lot of legacy code, which results in a download size of 821 KiB. tmux is noticeably smaller, only 237 KiB. But this is still huge in comparison to dtach and dvtm, whose combined download size is only 81 KiB. This is probably due to their adherence to Unix principles, which helps to keep the bloat at bay.
But not only the download is smaller, the memory usage of a dtach+dvtm session is significantly below that of the others, too.
Winner: dtach+dvtm

Ease of use

The best way to start screen or tmux is just running the binary. You will be immediately in an environment where you can use all the features. dtach and dvtm have to be started together, and the user himself has to manage the dtach sessions manually.
Winner: Tie between screen and tmux

Conclusion

All contenders have been able to win two of the comparisons. If you are already used to screen and don't need the extra features of tmux, then you can stay with screen.
If you prefer an elegant and Unix-like approach, dtach+dvtm are what you want.
If you however want many features and a solution that Just Works™, then tmux may be for you.