When you work with terminals in Linux often, you’re bound to run into some struggles when you want to multitask. Multiple windows or tabs are fine, but when you’re logged into a remote server or other system, you don’t always have access to tabs or multiple terminal windows. That’s where the stalwart members of the Linux system administration world
screen come in. But, as with all things in the open source community, the choice here isn’t clear as to which one of these commands is better for your usage. Today, we walk you through
screen to decide which is the best terminal multiplexer.
Features of Terminal Multiplexers
screen are terminal multiplexers, there are a few main features I want to talk about because that makes the differences between them a little more apparent. You’ll generally press a particular key combination that doesn’t register anywhere else in the system to use different features of your multiplexer.
Tip: Get our Tmux keyboard shortcuts cheatsheet for a complete overview of basic keybindings.
Detaching and Reattaching
You can start a session in a Terminal Multiplexer, do some work, and detach it to get it off your screen. This will also keep that session alive if you log off, which keeps sensitive data from being lost. You can then reattach it once you’re ready and need to start working there again.
You can also split your terminal session into tiles, creating multiple visible terminal sessions at once. This is great if you’re keeping track of a few different aspects of system resource usage, like power, RAM, CPU, and disk IO, and you want to use different monitors to keep track of those different things. Or, you can keep an eye on a system monitor while you compile or compress a large project, which makes it easy to keep track of load if something goes haywire.
There are a few ways that Terminal Multiplexers help you keep track of your sessions. One is that when you detach multiple sessions, you can see all of them at a glance. This is nice if you start multiple sessions, then aren’t sure which one you should go back to. Plus, you can also name or label the sessions, which makes it simple to keep track of your workspaces. They start to become a little like virtual desktops on a typical desktop operating system.
Features of tmux
One of the primary features that I really like about tmux is that you can control sessions from your normal shell prompt without having to enter the session you’ve created. (You can learn about tmux usage here.) A great example is killing sessions, which can be done via the
tmux kill-session command. If you know for a fact that you’re done with a particular tmux session, you can just kill it from your shell prompt.
There’s also a nice status bar in the bottom of the screen rather than taking over the terminal prompt at the top of the window. It’s a little easier to visualize a tmux workflow than it is with screen. Plus, the sessions rename themselves automatically based on the command you’re running, which is useful if you forget to name them.
Features of screen
To get started with screen, check out our tutorial here. There is one main feature of screen that helps it stand out from tmux: session sharing with other users, which can be great on multi-user systems that have multiple admins working on it at once for troubleshooting purposes.
Another plus is that if you’re using a Mac, you don’t have to mess around with homebrew to get screen installed – it’s built right into the terminal.
screen vs. tmux in a nutshell
If I had to suggest one, I’d suggest tmux. There are a few things that make tmux better. A great example is how you can switch
kill-session and end a session without having to go back in, end the command, then type
exit. Plus, the status bar is easier to read, and the commands are a little more human-readable.
For a macOS user, screen may be more convenient, as there’s no need for homebrew to get going.
Our latest tutorials delivered straight to your inbox