Code
Fix Joseph Posted on 2:06 am

Session management: tmux

Managing your workspace with tmux
Ttmux is one of the Linux terminal tools, more precisely the terminal multiplexer, which allows you to create multiple permanent terminals within a single login. In other words, tmux is a program which allows you to have several “tabs” in one terminal window.

tmux will be useful in the following cases:

  • if compilation or other similar operation is likely to take a long time in the long run;
  • for interactive multitasking;
  • in unusual cases, such as when programming in pairs;
  • in order to save time and perform several operations at once.

A quick guide to tmux
Standard tmux workflow:

  • tmux new -s s1 # start a new session

Ctrl+B :detach allows to interrupt the session, logout, go home.

You can log back in later. To do this you need:

  • tmux a-t s1

Additional useful tmux commands:

  • Ctrl+B ( – return to previous session;
  • Ctrl+B ) – switch to the next session;
  • tmux ls – get a list of all the sessions;
  • tmux kill-session -t s1 – end of session.

Direct collaboration in tmux:

user1

  • tmux -S /tmp/collab
  • chmod 777 /tmp/collab

user2

  • tmux -S /tmp/collab attach

Creating parts of a window and synchronizing them

  • tmux new -s s2 – start a new session;
  • Ctrl+B ” – horizontal division;
  • Ctrl+B % – vertical separation;
  • Ctrl+B :setw – to enable and disable synchronization;
  • Ctrl+B o – scroll windows;
  • Ctrl+B x – remove active windows.