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

  • djrubbie
    link
    fedilink
    31 year ago

    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.

    • Deebster
      link
      fedilink
      31 year ago

      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
        link
        fedilink
        3
        edit-2
        1 year ago

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

    • janAkali
      link
      fedilink
      1
      edit-2
      1 year ago

      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.