this post was submitted on 11 Jul 2023
127 points (100.0% liked)

Linux

48240 readers
583 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

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

you are viewing a single comment's thread
view the rest of the comments
[–] Phoenix3875@lemmy.world 13 points 1 year ago* (last edited 1 year ago) (4 children)

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:

tmux may be detached from a screen and continue running in the background, then later reattached.

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:

Each session is persistent and will survive accidental disconnection (such as ssh(1) connection timeout) or intentional detaching

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.

[–] SpaceCadet2000@kbin.social 3 points 1 year ago (3 children)

The real power of tmux, though, is that it manages the session you created.
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.

systemd: Oh yeah? Hold my beer

[–] KRAW@linux.community 1 points 1 year ago

I don't get what you're referencing... does systemd break this functionality of tmux or something?

[–] qjkxbmwvz@lemmy.sdf.org 1 points 1 year ago

That was infuriating to read. Thanks.