tmux: A Beginner's Guide

I'm not quite convinced of tmux's superiority yet.—I mean, I've been using it for a while now (couple of months maybe) and it's working quite fine, bu

List Windows in a Session

To list the windows in a session, use the "list-windows" tmux commands. E.g. to list the windows in a session named "chat" use:

$ tmux list-windows -t chat
0: zsh [239x69]
1: man tmux [239x69]
2: emacs [239x69]
3: zsh [239x69]

And, of course, if you don't specify a target session which to list, you get a list of the windows in the current session.

Grab a Window from Another Session

Grabbing the window "emacs" from the "chat" session and move it into the current session.

$ tmux move-window -s chat:emacs

You can also use "link-window", instead of "move-window", to attach the window to the current session without removing it from the old one (thereby causing the same window to appear in both sessions).

What I Don't Like About tmux

a) There is no way to get the name of the current session. I.e. if I just want to know the name of the session I'm in (the environment variable $STY in screen) I'm outta luck.

Okay, I admit, screen handles renaming of sessions very poorly ($STY only the new session name in new windows, and old windows cannot "talk" to the screen daemon they're running under unless one manually sets $STY to the new session name)—but not being able to figure out which session I'm running under from the command line, without listing the window contents of all running sessions and comparing it to the list of windows in the current session seem a bit cumbersome to me.

b) If I upgrade tmux on my machine I loose contact with all my tmux windows/sessions. :( irssi handles the exact same scenario marvellously—after doing an upgrade of irssi on my machine I can just run /upgrade and then I'm running under the new version, with all my connections and buffers and scrollbacks all intact.


By Zrajm C Akfohg in Uppsala [2010-01-08] (Validate: XHTML, CSS, links License: CC BY–SA)