Stories
Slash Boxes
Comments

SoylentNews is people

posted by Fnord666 on Wednesday September 25 2019, @03:43AM   Printer-friendly
from the multitasking dept.

Arthur T Knackerbracket has found the following story:

Tmux is a very powerful terminal multiplexer which is extremely useful especially when you are using the remote server via SSH.

If we want to do multiple tasks simultaneously on the remote server, usually we have to two ways to do it. We could SSH into the remote server and run everything in the background with an ‘&’ at the end of each terminal command. This is problematic if you want to monitor the process of each task. We could also open multiple windows, SSH into the remote server for each window, and run one task for each window. This is good for monitoring all the tasks, but the shortcoming is that you would have to type your SSH login information for each of the windows you opened. Sometimes it is also hard to find which window is doing which task if there are too many windows opened.

Tmux allows the user to create multiple sessions and each session could have multiple terminals. The user would be able to control multiple tasks in multiple windows via Tmux. No more multiple SSH logins anymore. However, Tmux is not very friendly to beginners because you would have to memorize a series of commands required for controlling Tmux. Although Tmux is much useful than a terminal emulator such as Gnome Terminator, many users would just like to use Tmux as a multi-window terminal emulator. However, Tmux does not memorize user settings such as pane layouts, so every time after reboot or restart the Tmux server, all of the user settings will be gone.

In this short tutorial, I am going through some of the basic concepts and commands for Tmux, and how to use a Tmux plugin, which is called Tmux Resurrect, to restore Tmux environment after reboot or Tmux server restart.


Original Submission

 
This discussion has been archived. No new comments can be posted.
Display Options Threshold/Breakthrough Mark All as Read Mark All as Unread
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
  • (Score: 3, Interesting) by Anonymous Coward on Wednesday September 25 2019, @01:00PM (4 children)

    by Anonymous Coward on Wednesday September 25 2019, @01:00PM (#898469)

    systemd already tried to kill screen and tmux in favor of systemd-specific bullshit:

    "systemd-logind will now by default terminate user processes...you can no longer start a screen or tmux session, log out, and expect to come back to it"

    "[The fix is] two lines: [Login]\nKillUserProcesses=no. But please consider switching to the new mode of using systemd-run instead."

    Starting Score:    0  points
    Moderation   +3  
       Interesting=3, Total=3
    Extra 'Interesting' Modifier   0  

    Total Score:   3  
  • (Score: 0) by Anonymous Coward on Wednesday September 25 2019, @04:29PM (2 children)

    by Anonymous Coward on Wednesday September 25 2019, @04:29PM (#898603)

    I'm hoping that you just made that up.

    • (Score: 0) by Anonymous Coward on Thursday September 26 2019, @04:52AM (1 child)

      by Anonymous Coward on Thursday September 26 2019, @04:52AM (#898941)

      No joke. Citations:

      https://leadtosilverlining.blogspot.com/2019/01/setup-desktop-environment-on-google.html [blogspot.com]
      https://groups.google.com/forum/?_escaped_fragment_=topic/linux.debian.bugs.dist/XSGzxX4se4k#!topic/linux.debian.bugs.dist/XSGzxX4se4k [google.com]

      Choicequote:

      new requirement of having to enable lingering and starting
      tmux/screen/nohup/ via systemd-run can certainly be considered a
      nuisance and something our users are not necessarily aware of.

      And then their answer was to hack the applications!

      However, this really shouldn't be such a general problem: If/when we
      can change tmux and screen to use PAM or enable lingering, then I
      think we get the best of both worlds: Logging out would clean up
      properly, but the (relatively few) users who use screen/tmux on a PC
      would get the expected behaviour of those processes surviving.

      • (Score: 0) by Anonymous Coward on Thursday September 26 2019, @06:53AM

        by Anonymous Coward on Thursday September 26 2019, @06:53AM (#899003)

        I wonder if you could get around this by having a screen.service that executes "screen -D -m -S boot" on startup with a restart OnFailure. With one surviving screen process belonging to another user, it would seem all sessions would survive, even if systemd killed all the user-owned screen processes, but I'm not actually sure.

  • (Score: 0) by Anonymous Coward on Wednesday September 25 2019, @07:26PM

    by Anonymous Coward on Wednesday September 25 2019, @07:26PM (#898713)

    I forgot about that. Yet another reminder how systemd doesn't really consider it to be "my system" anymore.