Hey there, fellow terminal wizards! There’s nothing I appreciate more than an efficient workflow, especially when I’m navigating through multiple terminal windows. That’s where Tmux truly shines. In this blog post, I’m going to share the art of switching windows in Tmux, a fundamental aspect of this powerful terminal multiplexer. Ready to get your fingers dancing on the keyboard? Let’s dive right in!
First-timers, take a quick detour through the basics of Tmux. Everyone else, strap in and let’s get started!
Let’s say you have already created one or more tmux sessions, with several windows and panes. We will discuss how you can rename a tmux window to access it easily directly by its name.
Switch Tmux Windows
Let’s consider the case where you have created several windows. Let’s say you are inside a tmux window ‘A’ i.e., your cursor is active in a pane in the window you wish to switch from.
Switch to Previous Window
You can use the following keyboard shortcut to navigate to previous window-
Prefix + p
By default the prefix is Ctrl-B
, so to switch to previous window you can run the following command-
Ctrl-B + p
Switch to Next Window
You can use the following keyboard shortcut to navigate to next window-
Prefix + n
By default the prefix is Ctrl-B
, so to switch to next window you can run the following command-
Ctrl-B + n
Switch to the last selected window
You can use the following keyboard shortcut to navigate to least recently selected window i.e., the previous window you were active in-
Prefix + l
By default the prefix is Ctrl-B
, so to switch to least recently selected window you can run the following command-
Ctrl-B + l
You can also switch pane, switch across sessions or move panes to left or right to organize the way you want.
I hope you found this article useful, glad that you found it easy to switch windows in Tmux. And there you have it – the ins and outs of switching windows in Tmux! Isn’t it amazing how this simple command can drastically improve your productivity? I surely think so. Remember, mastering these shortcuts is just the first step. Continue to explore and you’ll uncover the true potential of Tmux. Stay tuned for more Tmux tips and tricks that will help you become a terminal power user!
You can also check out the complete tmux cheatsheet of keyboard shortcuts and mouse shortcuts.