Tag and kill several Tmux windows ============================ Last edited: $Date: 2020/12/21 20:57:15 $ At the end of the day I usually end up with a lot of windows in my Tmux session, each with one or sometimes two panes (I have almost never more than two panes in any of my Tmux window). Usually I don't want to kill my entire Tmux session, so I have to close the windows I won't be needing the next day. Tmux tree mode -------------- For this, the Tmux tree mode is very useful. Tmux tree mode displays a list to browse sessions, windows and panes in the upper part of the window. In the lower part of the window Tmux tree mode displays a part of the pane(s) of the current window. Using the up and down arrow keys, or j and k if you activated vi mode, selects other windows in the list and shows the pane(s) of those windows. This is an easy way to search for a certain pane, but is also useful for other actions. The list starts with sessions expanded so windows are shown and with the current window in the attached session selected. ``O`` (shift-o) reverses the sort order. You can tag items in the tree with ``t``. ``t`` toggles the tag, so hitting ``t`` again will untag the item. ``T`` (shift-t) untags all tagged items, and ``Ctrl-t`` tags all times in the list. The default key binding for switching to tree mode is ``-w``. My Tmux configuration binds ```` to ``Ctrl- a``. This means that ``Ctrl-A w`` switches to tree mode. Killing windows --------------- After selecting one or more windows with ``t``, you can kill all tagged windows with ``X`` (shift-x). This will kill the tagged windows including all the panes in the tagged windows. Entire workflow --------------- Wrapping it up, this means, at the end of the day, I do: Ctrl-A w ... tag windows with t X