tmux shortcuts & cheatsheet
tmux config file
tmux config fileLocated here: ~/.tmux.conf
tmux show -g will show you the current settings. You can write that to the config file with
tmux show -g > ~/.tmux.confBy modifying the previous command, you can prepend each line with the needed set-option -g
FINAL COMMAND:
tmux show -g | sed 's/^/set-option -g /' > ~/.tmux.conftmux commands
tmux commandsstart new:
tmuxstart new with session name:
tmux new -s mynameattach:
tmux a # (or at, or attach)attach to named:
list sessions:
kill sessions:
kill all sessions:
In tmux, hit the prefix ctrl + b and then:
Sessions
Windows (tabs)
Panes (splits)
Sync Panes
You can do this by switching to the appropriate window, typing your Tmux prefix (commonly Ctrl-B or Ctrl-A) and then a colon to bring up a Tmux command line, and typing:
You can optionally add on or off to specify which state you want; otherwise the option is simply toggled. This option is specific to one window, so it won’t change the way your other sessions or windows operate. When you’re done, toggle it off again by repeating the command. tip source
Resizing Panes
You can also resize panes if you don’t like the layout defaults. I personally rarely need to do this, though it’s handy to know how. Here is the basic syntax to resize panes:
Copy mode:
Pressing PREFIX [ places us in Copy mode. We can then use our movement keys to move our cursor around the screen. By default, the arrow keys work. we set our configuration file to use Vim keys for moving between windows and resizing panes so we wouldn’t have to take our hands off the home row. tmux has a vi mode for working with the buffer as well. To enable it, add this line to .tmux.conf:
With this option set, we can use h, j, k, and l to move around our buffer.
To get out of Copy mode, we just press the ENTER key. Moving around one character at a time isn’t very efficient. Since we enabled vi mode, we can also use some other visible shortcuts to move around the buffer.
For example, we can use w to jump to the next word and b to jump back one word. And we can use f, followed by any character, to jump to that character on the same line, and F to jump backwards on the line.
Misc
Configurations Options:
Resources:
Notes:
Changelog:
1411143833002 - Added toggle zoom under Panes (splits) section.
1411143833002 - Added Sync Panes
1414276652677 - Added Kill all tmux sessions
Request an Update:
We Noticed that our Cheatsheet is growing and people are coloberating to add new tips and tricks, so please tweet to me what would you like to add and let's make it better!
Twitter: @MohammedAlaa
Last updated
Was this helpful?