====== Tmux ====== ===== Documentation ===== * Ctrl-b c Create new window * Ctrl-b d Detach current client * Ctrl-b l Move to previously selected window * Ctrl-b n Move to the next window * Ctrl-b p Move to the previous window * Ctrl-b & Kill the current window * Ctrl-b , Rename the current window * Ctrl-b % Split the current window into two panes * Ctrl-b q Show pane numbers (used to switch between panes) * Ctrl-b o Switch to the next pane * Ctrl-b ? List all keybindings ==== Basic Window Handling ==== Start up tmux with the tmux command and you should be greeted with a simplistic terminal window that resembles screen – the only difference is it has a default status bar which is nice (easily added to screen as well). Now let’s create a couple of windows and go through them (we’ll be using the default bindings). Hit Ctrl-b c a few times to create a few windows, you should notice that there are more tabs in the status bar. Now if you’re like me you like to have descriptive names of which each window is for, so let’s rename them by hitting Ctrl-b ,. It should prompt you to rename the current window – type anything you want and hit enter. Now the current window is renamed to what you specified. Now going forward I’m going to have two windows open respectively named “window1″ and “window2″. Once you rename your windows lets switch back and forth. We have several different ways of switching windows, so I’ll go over the ones I personally use: * Ctrl-b n (Move to the next window) * Ctrl-b p (Move to the previous window) * Ctrl-b l (Move to the previously selected window) * Ctrl-b w (List all windows / window numbers) * Ctrl-b (Move to the specified window number, the default bindings are from 0 – 9) Now these ones fairly self explanatory however they don’t really cater to a lot of different windows. What if you have 10+ windows open? It becomes quite tedious to find the window you want – but don’t fret! Tmux has a find-window option & keybinding. Type Ctrl-b f and type in the window name you want (it actually searches for the window so you can type in only part of the name of the window you’re looking for). You can also get a list of the windows in the current session by executing the list-windows command. To execute commands interactively you type Ctrl-b : which will bring up a text prompt. From there you can execute any command tmux supports interactively (tab completion is supported). ==== Basic Pane Handling ==== One of the most powerful features tmux offers is the ability to split up your current window into “panes”. Anyone whose familiar with tiling windows managers will feel quite at home. * Ctrl-b % (Split the window vertically) * Ctrl-b : “split-window” (Split window horizontally) * Ctrl-b o (Goto next pane) * Ctrl-b q (Show pane numbers, when the numbers show up type the key to goto that pane) * Ctrl-b { (Move the current pane left) * Ctrl-b } (Move the current pane right) * Ctrl-b PgUp (Scroll the pane up, copy mode) Now some obviously the default bindings don’t encompass some of features, such as splitting horizontally. I personally rebind the keys so “|” splits the current window vertically, and “-” splits it horizontally. Not the easiest things to type, though easy to remember. You can achieve this by putting the following in ~/.tmux.conf or by typing it in the interactive prompt (Ctrl-b :). Keep in mind if you do the latter it will only be in effect for that session: unbind % bind | split-window -h bind – split-window -v