Join my Bash scripting course on Udemy 👀

Switching tmux windows faster with alt+number

October 11, 2020  ‐ 2 min read

I'm switching quite often. So the default tmux binding of <prefix> <number> starts to feel a bit expensive. I therefor decided that I wanted to switch tmux windows with alt+<number> instead.

This is pretty similar to how I switch workspaces in i3, my window manager (I should checkout sway once, heard it was nice). And the same as in Google Chrome actually.

You can add these alt+number keybindings by putting the following in your ~/.tmux.conf file.

# ~/.tmux.conf

# Switch windows alt+number
bind-key -n M-1 select-window -t 1
bind-key -n M-2 select-window -t 2
bind-key -n M-3 select-window -t 3
bind-key -n M-4 select-window -t 4
bind-key -n M-5 select-window -t 5
bind-key -n M-6 select-window -t 6
bind-key -n M-7 select-window -t 7
bind-key -n M-8 select-window -t 8
bind-key -n M-9 select-window -t 9

Learn more

A great resource for learning more about tmux are its man pages. You can read them online here or from the command-line using the following command:

$ man tmux

Or take a look at this book: