4 productivity-boosting tmux features you should be using
Has your terminal app ever crashed mid-op? Ever wish you didn't have to juggle multiple terminal tabs or deal with failed processes caused by terminal connection drops? If any of that sounds relatable, multiplexing, which isn't as complicated as it sounds, can save you from the tab chaos and turn your Linux terminal into a productivity dashboard.
Is terminal multiplexing as complicated as it sounds?
Terminal multiplexers turn a terminal window into a multi-pane dashboard that lets you do more than you can in a single terminal. You can, for instance, use a multiplexer to create a 4-pane dashboard where one pane is for script updates, the next handles starting and managing systemd timers and Linux service units, with the remaining panes dedicated to SSHing into a server and executing commands.
The great news is that there is no shortage of good terminal multiplexing tools . But, with over 40k stars and 2k forks on GitHub, tmux, which literally means terminal multiplexer, is one of the most widely used terminal managers.
Although tmux has plenty of amazing terminal management features, here are my favorite ones that improve what you and I can do in a single terminal window.
Instead of tab-hopping, create and manage multiple terminal windows and panes
Picture this. You're working on a project that requires you to know the RAM an app or script uses whenever it runs. You also need to monitor the log for real-time updates, keep an eye on network usage, and still have an open terminal workspace. Instead of opening several tools to get that snapshot, you can save time by creating a simple multi-pane tmux dashboard for the workflow.
Don't have tmux installed? Here's how to install it right now on different Linux systems.
In the screenshot below, I've created a 4-pane tmux terminal dashboard, where, in panes 1 and 2, I'm using htop to show resource usage and journalctl to show live Linux system log updates. In pane 3, I've used nload to show a basic traffic interface, while pane 4 is a workspace.
You can use tmux to create a similar or better terminal dashboard that suits your workflow. After installing tmux, start it using the command:
To create new windows, move between panes and create new ones, combine the default prefix, which is Ctrl + b (if you haven't changed it), with basic window management key bindings like:
Creating persistent tmux terminal sessions by detaching and attaching to them
How much would your terminal sessions improve if you could leave tasks running after exiting the terminal but still be able to jump back into them whenever you want? That's what tmux's killer feature, terminal persistence, does: it keeps long-running tasks, such as large wget downloads and backup or system monitoring scripts, running in the background.
Persistent terminals can also protect ongoing operations from unexpected emulator crashes or connection drops. Let's say you have a large backup or download process you want to keep running while you do other things. Using tmux, you can start the process, detach from it, exit the terminal without stopping the process, go about your work, and still jump back into it.
To detach from a terminal session, hit the prefix and then d (for detach):
To attach to the session after exiting, open a new terminal window, then use the attach command:
In the screenshot below, I have a 4-pane terminal dashboard. In panes 1 and 2, I'm running htop and nload. In pane 3, I have a running backup script, and in pane 4, a normal terminal window from which I can work.
I can detach from this session, exit the terminal, but keep the process running, and reattach to it later to check progress.
Terminal persistence can be a game-changer if you frequently SSH into Proxmox, Plex, and other servers.
Customizing tmux for workflow optimization
Tmux is massively configurable and customizable. For example, if you'd rather not fiddle with the prefix key every time you need to switch panes, enable mouse settings and customize them to persist across reboots. Enabling the mouse makes switching between panes faster. It also enables copying and pasting commands between panes and dragging the borders to resize panes.
Enable persistent mouse settings by opening tmux's configuration file with nano, adding the following text, then running the command below or pressing the prefix + r to activate it.
When working with a persistent terminal session, customizing panes and giving them unique names can significantly improve your work. To show pane names, use nano to open tmux's configuration file, then add the following text that adds pane titles and borders, where #T shows pane title and #P shows pane index:
Save the configuration file, then set each pane's name by navigating to it, entering command mode by pressing the prefix + : and executing this command:
To rename windows, hit the prefix + , then name your window:
Using scripts for advanced customizations and workflow optimizations
Tmux can do way more, and you can use scripts to customize a ton of other things, add functionalities, and do so much more. For example, you can find scripts that customize tmux's colors and themes , the status line, automatically name windows and panes based on running processes, and so much more. And guess what? Because tmux is one of the most widely used terminal multiplexers, such scripts are not difficult to find on the internet. Plus, the tmux manpage is an information treasure trove. Access it from a normal terminal using the command:
I've barely scratched the surface of what tmux can do, but these four features can help you start using it like a pro.
