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

Linux

1258 readers
108 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

top 10 comments
sorted by: hot top controversial new old
[–] TheEntity@kbin.social 2 points 1 year ago

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

Not every terminal emulator has window splitting capabilities. Some, like Alacritty, specifically expect you to run a program like tmux if you want this functionality. Splitting within tmux also makes it vastly easier to multitask on a remote host via SSH: if you run a remote tmux, every split window is already running on the same remote host, no need to log in again and again.

[–] celestineschrunk@lemmy.run 1 points 1 year ago (1 children)
[–] jackofalltrades@lemmy.ml 1 points 1 year ago

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.

Thank you, I'll check on it!

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

What if we put a terminal in your terminal, so you could terminal while you terminal?

[–] testman@lemmy.ml 0 points 1 year ago (1 children)

sup dawg, heard you like sessions

[–] Deceptichum@kbin.social 1 points 1 year ago

It's an older meme, sir, but it checks out..

[–] bionicjoey@lemmy.ca 1 points 1 year ago

Decoupling the terminal from the shell also means you can keep your shell open while closing your terminal window. This can be useful on servers, or for long running commands that you want to be able to check on.

[–] 0xtero@kbin.social 1 points 1 year ago

I guess the best analogy is a "virtual desktop" but for the terminal.
It's is a program which runs in a terminal and allows multiple other terminal programs to be run inside it.

Each program inside tmux gets its own "page" or "screen" and you can jump between them (next-screen, previous-screen etc).
So instead of having multiple terminal windows, you only have one and switch the screen/page inside it.

You can detech from the program and leave it running - so next time you log on to the server, you can re-attach to it and all your screens/sessions are still there.

Not super useful on your local machine - but when you have to connect to a remote server (or several) is really shines. Especially if you have to go through a jumphost. You can just connect to your jumphost, start tmux, then create a "screen" for each server you need to connect to - do your stuff and deattach. Next time, just re-attach and all your stuff is there.

Did that help?

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

Tmux is no different from a terminal app that split the screen in terms of "multi window" functionality. However it's not a graphical software, so you can start it remotely (eg. over ssh), and detach/reattach to it later without loosing what you where doing.

[–] Corngood@lemmy.ml 0 points 1 year ago

I didn't see this mentioned, but by far the thing I depend on tmux for the most is being able to quickly copy and paste text from the terminal. e.g. grabbing a file name from the output of git diff. How does everyone else do this?

Another cool one is being able to attach to a session on my phone to check on something, and have it automatically resize without disconnecting my desktop.