• rockSlayer@lemmy.blahaj.zone
    link
    fedilink
    English
    arrow-up
    4
    ·
    17 days ago

    I use tmux at work, it’s glorious! I have to ssh into GCP, which has been nationwide compute availability and frequently drops SSH connections. Tmux saves my place for me, and acts almost like multiple tabs

    • rbos@lemmy.ca
      link
      fedilink
      English
      arrow-up
      2
      ·
      17 days ago

      Look into mosh-server as well. Handles sketchy connections a treat.

  • KickMeElmo@sopuli.xyz
    link
    fedilink
    arrow-up
    4
    ·
    17 days ago

    One thing I have never had answered: I’m already used to GNU screen. What does tmux bring to the table for me?

    • historicaldocuments@lemmy.world
      link
      fedilink
      arrow-up
      4
      ·
      17 days ago

      There’s a pretty good python module for talking to tmux sessions/windows/panes, etc. You can also use tmux to lay out terminals in a grid, or one big pane and some smaller ones, or some mid sized ones or whatever.

      If you’re good with screen and happy with it you’d might as well stay with screen if only to not get key chords mixed up. I’d recommend tmux over screen to newbies. There are some decent screenshots of complicated tmux layouts on the internet. Depending on what i was doing I could see having a pane for giving input to a process, a pane for tail -f output or logging, etc., and a pane for btop to monitor resources.

      • KickMeElmo@sopuli.xyz
        link
        fedilink
        arrow-up
        2
        ·
        17 days ago

        Screen supports subdividing panes as well, though now I’m curious if tmux has better performance with panes. One issue I did have with screen was exactly that, having about 4-5 panes at once watching a process from different angles and I could tell it wasn’t running at full speed until I split up the panes. That alone could be a reason to relearn some muscle memory.

        • historicaldocuments@lemmy.world
          link
          fedilink
          arrow-up
          3
          ·
          16 days ago

          One thing I’m using has six tmux panes in a window, then another window that I forgot was running with two more panes, and that’s just for that session. I haven’t noticed any performance issues, but that could be workflow dependent.

          That alone could be a reason to relearn some muscle memory.

          In the before times when I was learning UNIX (ssh over dialup) screen was the confusing godsend that made it so my programs would stay running, but once I got reliable connections/workflows/some money to buy better stuff) I never really had a desire to go back and look at screen. Once I found tmux I really doubt I’ll ever revisit screen. Ctrl+b," gives you a new pane “below” and Ctrl+b, % gives you a new pane to the right. Ctrl+b,w gives you a little menu for all the sessions/windows/panes you have in tmux. set -g mouse on in .tmux.conf to click the panes. Copy/pasting text isn’t as easy as I’d like, but that’s probably a skill/configuration issue on my part. Hope that helps.

    • rbos@lemmy.ca
      link
      fedilink
      English
      arrow-up
      3
      ·
      17 days ago

      For me it was sending commands to named panes. Let me automate some pretty annoying apps that demanded to be run in an open console.

      • historicaldocuments@lemmy.world
        link
        fedilink
        arrow-up
        1
        ·
        16 days ago

        Did you end up using send-keys for that?

        I’ve dealt with that kind of thing in the past, and one thing I wanted to do that I never found a good solution for was to make it so that a pane was “read only” in that it could be scrolled with a mouse, but accept key presses (with page up/down arrows doing scrolling as a stretch goal). Did you ever deal with that/find a solution?

        • rbos@lemmy.ca
          link
          fedilink
          English
          arrow-up
          1
          ·
          16 days ago

          I’ve never tried scrolling with mouse but it does work with arrow keys and pgupdn.

          Yes to send-keys.

          • historicaldocuments@lemmy.world
            link
            fedilink
            arrow-up
            2
            ·
            16 days ago

            Scrolling with a mouse works, just not exactly the way I thought it would when I started using it.

            I started out with a shell script using send-keys, and eventually decided the python tmux library was a nice improvement.

            • rbos@lemmy.ca
              link
              fedilink
              English
              arrow-up
              1
              ·
              16 days ago

              Nice. I wrap send-keys with a little perl script, I should look into that Python lib.

              • historicaldocuments@lemmy.world
                link
                fedilink
                arrow-up
                2
                ·
                16 days ago

                It’s not bad at all. It gets monumentally easier if you’ve named all your sessions and windows because it’s just a .get() to look them up. Panes still have that thing where the panes can get renumbered inside a window, but still have the same internal immutable identifier underneath the hood, but you wind up with pane.send_keys(my_string, enter=True) which is well worth the learning curve IMO.

                • rbos@lemmy.ca
                  link
                  fedilink
                  English
                  arrow-up
                  2
                  ·
                  16 days ago

                  Totally. And you can start a new panel from a script with a specific name as well.

                  I use it for managing minecraft servers.

    • Cheebus@lemmy.world
      link
      fedilink
      arrow-up
      3
      ·
      17 days ago

      when i have an ssh connection on a server and am running tasks that take a while

      if i use tmux i dont lose my process if my connection drops

    • 4am@lemmy.zip
      link
      fedilink
      arrow-up
      2
      ·
      17 days ago

      Tmux lets you run multiple panes with different shell instances in them and arrange them on the screen however you like, and different “windows” so you can group up panes like browser tabs. It’s a bit fancier and more versatile than screen but they’re both tools that do a similar job