Share:

Persistent sesions with tmux and byobu

You you want to learn more on linux terminals to avoid nohup and improve persistent sessions, the recomended/advanced way to run any linux application in background is to use a terminal multiplexer like screen (old), tmux (new), byobu a nicer front-end for the other two.

You can see an introduction about tmux, xpra and vim in a seminar about Remote Development and Computing, by Albert Gil.

If you don't know tmux or byobu, you definetly should.
These tools are a huge improvement for terminal tasks, specially when working with remote servers and long tasks.

tmux is a new implementation of the old screen, written from scratch and with much more features.
byobu is a nicer and simpler front-end of tmux and screen.

tmux is highly customizable, but it's defaults are kind of ugly and not much user-friendly.
byobu provides better defaults and a more user-friendly start, but it's probably less customizable.

They both provide three main features:

  • Persistency
    • you shouldn't need to worry anymore about running process in background (&) or with nohup
  • Multiplexing
    • you can have multiple sessions, windows/tabs and panes, you don't need any feature of the terminal emulator
  • Multi attach
    • you can attach to a terminal from different places at the same time, so you can share your terminal with your teamates or your support team to fix issues

Please, take a look to this tutorial:

You can also checkout this talk about Remote Development and Computing, or this small video of the book ''Using tmux for productive mouse-free programming''

Please note that for computing service jobs, using sbatch instead of srun is also recomended.