I am fairly familiar with Linux, I’ve been using different distros for some years now and have done some config editing here and there. I am also a web developer and use the terminal quite a lot and so I always stumble on people’s recommendation to use tmux and how good it is, but I never really understood what it does and, in layman’s terms, how can it be useful and for what use cases.
Can you guys please enlight me a bit on this?
Thank you.
Edit: if my phrasing is a bit awkward or confusing I apologize since I am not an English native speaker. (Maybe that’s why I never fully grasped what tmux is from other explanations xD)
Edite: Ok, just to clarify, my original struggle was to understand what made tmux different from using some terminal app and just split the screen xD
It’s a “terminal multiplexer”, i.e. you can start multiple terminals in a single terminal.
You might ask, why not open a new terminal window or tab? Well, you can only do that in a desktop environment and that’s not always available. Even if you can, you might want the terminals to be side by side in a single screen, which might not be easy to do with window tiling.
The real power of tmux, though, is that it manages the session you created. To quote from the manual:
So, one use case would be saving your current terminal setup. Instead of exiting the terminal and navigating to the project and setting up the environment again next time, you can simply detach and re-attach.
When connecting to a remote server, this is especially useful:
Suppose you want to execute a long running command on a remote server. If you just put it to foreground, when you exit the ssh session, the job is also killed. If you put it to the background, its output can’t be easily observed.
With
tmux
, you can simply run it in the foreground like normal and detach. When you reattach later, the job is running and you get all the output easily, as if you have been in that session all along.systemd
: Oh yeah? Hold my beerJust…wow.