There have been multiple accounts created with the sole purpose of posting advertisement posts or replies containing unsolicited advertising.

Accounts which solely post advertisements, or persistently post them may be terminated.

linux

This magazine is from a federated server and may be incomplete. Browse more on the original instance.

bitseek , in looks like 2023 is finally the year!
@bitseek@beehaw.org avatar

Personally I have to thank Steam for their commitment for gaming on Linux. Without I would not have been able to make the switch fully.

Phoenix3875 , (edited ) in Can you please ELI5 tmux?

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 ,
@SpaceCadet2000@kbin.social avatar

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

qjkxbmwvz ,

Just…wow.

zikk_transport2 , in Can you please ELI5 tmux?

In the company I work, we have to use jumpbox + “password” from proprietary code generator.

Imagine going through this, then you suddenly need 2nd terminal. Inconvenience doing it again in another terminal?

Well, there is a solution:

  1. tmux
  2. CTRL+B then ". And now you have 2 terminals.

Also tmux is great for “quick solution” kind of things - to leave something running in the background. Talking about background - you can have many terminals open, from only 1 SSH session. :)

spiritedaway , in [SOLVED] [Request] KDE Plasma Widget to Show JSON Results

Just to add, if you wanted to start VPN on boot automatically, you can create a systemd service file to take care of that and put it in ~/.config/systemd/user/

frizzle OP ,

I will look into it! Thanks for the idea.

iusearchbtw , in Can you please ELI5 tmux?
@iusearchbtw@lemmy.sdf.org avatar

tmux (and GNU screen, its older predecessor) is a terminal multiplexer, which is a fancy phrase used to describe turning one terminal window into multiple terminal windows. It basically turns a single terminal window into a text-based tiling window manager that lets you run different shells concurrently in a single terminal, easily copy text between them, and have other quality of life improvements over using a single raw terminal.

Imagine you’re SSH’d into a remote machine. Unless you SSH again from a different terminal at the same time, you’re basically limited to a single terminal, and whatever you’re doing is interrupted if your connection drops. tmux runs on the remote machine, which means that if your connection is interrupted, tmux will continue running exactly as you left it, and you’ll be able to reattach to it using tmux attach.

Or, imagine your video drivers break and you’re forced to troubleshoot in a raw TTY. tmux will let you have a manpage and a shell open at the same time, or three different directories opened side by side. That’s a slightly more convoluted use case, but the point is that terminal multiplexers make it far more convenient to use the terminal in basically any situation that’s not just running a single short command and leaving.

captain_aggravated , in Can you please ELI5 tmux?
@captain_aggravated@sh.itjust.works avatar

Have you ever seen someone use a tiling window manager instead of a desktop environment? Where it keeps all the currently running apps on screen in evenly sized tiles so you can see everything at once, nothing is in the “background?”

Tmux is a bit like that, but only for the terminal. It allows you to open multiple terminals in one “screen” or terminal emulator window, and switch between them with keyboard shortcuts. So if you want to look at your source code, test run your source code, and watch htop to see how it performs, you can do that with Tmux. It’s a bit less cumbersome than opening three terminal windows.

It also works over SSH, so you can SSH into a server or something, start tmux, then easily run several tools simultaneously.

Tmux sessions are also persistent. Imagine if you were in the middle of working on something on your desktop at the office, then it’s time to go home. You can detach your session, SSH into the box from your laptop, reattach that session and keep working right where you left off.

If you work in the terminal a lot, it’s a handy tool.

ray_gay , in What are your must-have packages?
@ray_gay@programming.dev avatar
  • neovim
  • alacritty
  • zsh
    • oh my zsh
    • starship (promp)
  • zellij
  • btop | htop
  • ripgrep
  • fd-find
  • exa
  • fnm (nvm alternative, since nvm starts too slow for me)
  • yt-dlp
  • bat (batcat)
  • the usual base-devel / build-essential
Ndy , in Suggest me a distro
@Ndy@kbin.social avatar

I started out with Mint but then tried out Ubuntu and now I'm using EndeavourOS on my laptop. So far EndeavourOS has been the best experience for me.

jalkasieni , in [SOLVED] [Request] KDE Plasma Widget to Show JSON Results

store.kde.org/p/1166510 might fit the bill.

frizzle OP ,

Thanks! That is exactly what I was looking for. Success

Now I just need to clean it up and make it look a little nicer.

hiyaaaaa23 ,

Was gonna suggest this

djrubbie , in Can you please ELI5 tmux?

Well, not knowing what other explanations you've read but don't understand/grasp makes it a bit difficult to narrow down specifics, though to start from the beginning, tmux is a terminal multiplexer, what that means is that it will allow multiple sessions running concurrently under the same virtual terminal. It provides keyboard shortcuts to switch between them, or split them and display them concurrently.

The biggest use case for me however (though I use an older one called screen out of hard to shake habits) is the ability to detach and attach at will, so that any disconnected remote sessions won't kill whatever I happen to be working on. Alternatively, I can have running sessions locally on my current machine and then I can go elsewhere and remote in and resume from where I've left off.

A somewhat frowned upon use case is to use it to run "background" processes on a remote server - like a development web service that you just can't be bothered to properly package/daemonize - just open screen or tmux, start it, and detach the session and it should stay running barring any other problems.

janAkali , (edited )

A somewhat frowned upon use case is to use it to run “background” processes on a remote server

in most cases screen/tmux is an overkill, I prefer using setsid for quick and dirty scripts, it just starts a process in a new session, detached from parent terminal. Or nohup when I need to check the output. Both available on most linux systems by default.

Deebster ,
@Deebster@lemmy.ml avatar

I use screen still too, partly because it’s generally installed on everything already, like vim. I hardly ever use anything but a maximised (i.e. full-terminal) screen at once, so it doesn’t sound like I’m missing much from tmux.

De/reattaching’s extremely useful and another thing I really like in screen is being able to scroll and search the scrollbuffer.

If I was ready for an upgrade, I’d probably go for zellij.

tal ,
@tal@kbin.social avatar

I use screen as well. It is significantly faster than tmux.

Sebito , (edited ) in What are your must-have packages?
@Sebito@lemmy.ml avatar
  • Kitty
  • fish + all the shell builtins
  • LunarVim (Neovim)
  • git + lazygit
  • openssh
  • npm
  • cargo
  • docker

Edit:

  • wget
  • httpie
  • tar & (un)zip
letbelight ,

Try podman it’s lighter than docker. 😂

andrew ,
@andrew@lemmy.stuart.fun avatar

And runs in unprivileged mode (nonroot) quite nicely.

Sebito ,
@Sebito@lemmy.ml avatar

I will! I once already used it for cross compiling and it seemed really nice ^^

0xd4n , in What are your must-have packages?
  • vim
  • bashtop
  • cmus
  • ghidra
  • jq (pretty print Json)
  • screen
  • hexedit
  • python3 with pwntools
  • GCC, g++, make & libc6-dev
  • gdb with pwndbg
  • alacritty
0xtero , in Can you please ELI5 tmux?
@0xtero@kbin.social avatar

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?

jackofalltrades OP ,

Ok, now I guess I am seeing the value of it, specially with the “virtual desktop” analogy and the remote scenario, since I need to do some of it at work and having everything as I left it last time will be nice. Thank you!

topperharlie ,

plus, if you disconnect in the middle of a command execution it doesn’t get killed (very important for system updates for example)

richardwonka ,

…. or if you get disconnected by, say, dodgy internet connection or such.

bionicjoey ,

Mosh is really good for that as well. It’s like the tmux of ssh

waspentalive ,

I use the “being able to detach and re-attach” capability to run my Minecraft server on my in-home server box.

BaconIsAVeg ,

Imagine you ssh into a server to do a database import, and from previous experience you know it will take about 3 hours. You start the restore, then get up to make dinner. You come back an hour later and realize you forgot to plug your laptop in.

Is the import command still running? Who knows.

With tmux you just charge your laptop, ssh in again, and reconnect to the virtual term that was running the command to check.

nous ,

You can also split windows to have multiple terminals side by side, or above below each other. Many use it locally as a tileing window manager when their main terminal or window manager does not support tiling.

adj ,

I actually get a lot of use out of it locally. I usually have multiple sessions for different concerns and prefix + s lets me switch between them quickly using vi keybindings. I can even do prefix + w to switch to a specific window in a different session.

I don’t use vscode much lately, but when I did it was also useful sometimes to have the same window in my terminal client on one desktop and in vscode’s terminal on another when switching back and forth a lot to see a browser or database client or whatever. Just having the freedom to move the session around to different applications is nice.

SpaceCadet ,
@SpaceCadet@lemmy.world avatar

deleted_by_author

  • Loading...
  • spauldo ,

    Yeesh, I never knew about that. Probably because I normally only worry about SIGHUP on *BSD.

    What kind of arrogance does it take to just decide to change how signals work?

    4am ,
    @4am@lemmy.world avatar

    Ugh I remembering learning upstart and getting decent with it and then everyone went “nope, systemd”

    Let’s just improve what we have and not change the whole goddamn thing again. That’s more annoying.

    Also, some of the people on hackernews are so cringy. Like, dude we get it there is a bad default. Make your case and stop being a total jerkoff, because no one is going to listen to that guy and I bet that’s like 20% of the reason the other übernerds are digging their heels in about changing it.

    Also fuck systemd 😅

    s38b35M5 ,
    @s38b35M5@lemmy.world avatar

    Adding to this comment that tmux allows team members spread through the world to work on the same terminal together on different SSH sessions.

    Both admins connect, then one spins up the tmux and the other can attach to it and both collaborate and see all inputs/outputs.

    larchy , in New Steam Client Stable Update Fixes UI Issues on Linux for Intel/AMD Users

    Just did a new Mint install yesterday and spent ages trying to figure out why steam was going bananas! Much joy.

    kurotora , in Can you please ELI5 tmux?

    Probably somebody can provide a better answer, but for me tmux is useful due that it has session manager (really useful if your remote connection drops) and the ability to split the screen in multiple screens (usually I split vertical, but you can create easily 4x4 screen).

    The only trick is the learning curve of the actions (usually ctrl + b and the key required). For example to split the window vertical, you must do ctrl + b and then %.

    But as I said, probably you will get better and more technical answers ^_^U

    EDIT: some grammar mistakes.

    drhoopoe ,

    The irony is that once you find your way around through the default keys and search a little you soon discover how easy it is to reset them with “sane” settings. Same for window frames, etc. But yes, there’s definitely a learning curve.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • [email protected]
  • random
  • lifeLocal
  • goranko
  • All magazines