2024-01-25

Migrate from GNU screen to tmux

I would have preferred to stay with "GNU screen" over migrating to something else and re-learning everything all over again, but screen does not appear to be under active development, and for years I have been living with an annoying bug, where screen occasionally goes bonkers when I'm using "vim" to edit a text file. The only solution in this case is to quit screen and restart it, which is inconvenient.

I am assuming that tmux, which is actively developed, does not have this problem. Hopefully whatever other problems it has won't be too severe.



Exiting

GNU screen

Either "exit"/CTRL-d from all running shells, or CTRL-a CTRL-\

tmux

Either "exit"/CTRL-d from all running shells, or CTRL-b :kill-session

Multiple instances

GNU screen

What happens when you run screen when another instance is already running? You get two screen instances, each running in a separate process. You can list all the screen instances with "screen -ls".

tmux

What happens when you run tmux when another instance is already running? You get two tmux instances, each running in a separate process. You can list all the tmux instances with "tmux ls". The tmux term for a tmux instance is "session".

In addition, you can work with sessions from inside tmux:

  • CTRL-b :list-sessions
  • Session and window preview/select tool: CTRL-b w

Bibliography

  1. https://www.howtogeek.com/671422/how-to-use-tmux-on-linux-and-why-its-better-than-screen/
  2. https://tmuxcheatsheet.com/
  3. https://github.com/tmux/tmux/wiki