Tmux and Cloudshell

Share on:

Tmux is a terminal multiplexer, which is a fancy way of saying it give you the ability to run multi terminals. Google Cloud Cloudshell uses the default Tmux configuration which makes me not want to use it.

Tmux with default settings:inline

However help is at hand. You can update the settings and this post covers how to make those changes. Cloudshell is meant to be a lite developer environment so I will only add some essential productivity changes.


The configuration to be applied will focus on three things:

  • Amend the default command key to CTRL-a
  • Amend window pane split command to use | and -
  • Amend pane movement commands to use Vim navigation key bindings
  1. In Cloud Shell create a new file called ~/.tmux.conf
  2. Add the following content to the file
 1# Amend Tmux invocation keys
 2# ctrl + b to ctrl + a
 3unbind C-b
 4set -g prefix C-a
 6# Set the delay
 7set -s escape-time 1
 9# Use | to split the window vertically: 
10# ctrl a |
11bind | split-window -h -c "#{pane_current_path}"
13# Use - to split the window horizontally: 
14# ctrl a -
15bind - split-window -v -c "#{pane_current_path}"
16unbind '"'
17unbind %
19# Move between panes using Vim keys: 
20# ctrl a [VIM KEY]
21bind h select-pane -L
22bind j select-pane -D
23bind k select-pane -U
24bind l select-pane -R
26# Sync windows - turn on/off: 
27# ctrl  a  o
28bind-key o set-window-option synchronize-panes\; display-message "synchronize-panes is now #{?pane_synchronized,on,off}"
  1. Source the configuration i.e. tell tmux we changed the configuration
1tmux source-file ~/.tmux.conf

Tmux is now setup to use CTRL a to initiate a command.

  • To initiate command mode use CTRL a (then let go of these keys)
  • Then press the command to execute i.e. | or -

For a more general tmux guide reference an earlier blog post: Setting up tmux

With the changes made, you can now use Tmux to work with multiple sessions without needing to open multiple tabs.

Tmux makes you feel awesome:inline