Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TMUX: Store related sessions in a group?

Tags:

tmux

When playing around with tmux the other day, I accidentally created a group for one session, which I can't seem to replicate. Although I already deleted the session which deleted the group it was in, it looked like this:

>>>Some_session: 2 windows (created Thu Jun 14 13:39:17 2018) [178x50] (group 6) (attached)

I considered some benefits to storing sessions in a group for organization and search efficiency.

I searched for an answer in various forums, tmux cheatsheets on Github, searching in tmux list-keys, etc., but with no luck.

The closest I found was a gist about window-groups but nothing on session groups.

This session group may act completely different than what I am considering it does. It may also be a pointless feature or valueless output that a noob like me just stumbled upon.

Whatever the case, I am curious what it is for and the command to create one.

Thanks.

like image 414
user669132 Avatar asked Jun 14 '18 20:06

user669132


1 Answers

The described behaviour happens when one specifies -t <group> while creating session. E.g.:

tmux new-session -t group1 -s Some_session

if you run tmux list-sessions. You'll see:

Some_session: 1 windows (created Tue Feb 12 16:34:10 2019) [232x64] (group group1) (attached)

tmux documentation explains what -t is doing:

If -t is given, it specifies a session group. Sessions in the same group share the same set of windows - new windows are linked to all sessions in the group and any windows closed removed from all sessions. The current and previous window and any session options remain independent and any session in a group may be killed without affecting the others.

Where it may be useful? Depends on your workflow. For example this answer describes how this feature enables having different windows of the same session in different terminals.

like image 74
Molecular Man Avatar answered Sep 24 '22 18:09

Molecular Man