Hello there! As we juggle multiple projects and tasks in Tmux, our workspace might get a bit cluttered with all the open windows. It’s only natural to want to close some of them to clear the clutter and focus on what truly matters. That’s where I come in. Today, I’ll be walking you through the process of closing a window in Tmux. So, fasten your seatbelt’s, and let’s dive right in!
If you are new to Tmux, then learn the basics of Tmux, if not, 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 close a tmux window.
Close current Tmux Window
Let’s consider the case where you are inside a tmux window i.e., your cursor is active in a pane in the window you wish to close.
You can use the following keyboard shortcut to close a window-
Prefix + &
By default the prefix is Ctrl-B
, so to close a tmux window you can run the following command-
Ctrl-B + &
Close Tmux Window using kill-window command
You can use the kill-window
command to kill or close the current tmux window-
$ tmux kill-window
Kill Tmux window by its position
It is possible to kill a target window from outside the current window by its index or position
$ tmux kill-window -t2
We’ve come to the end of our Tmux journey today, and I hope you’ve found this guide useful. Now you know how to close a window in Tmux, a handy skill that will certainly help you manage your workspace more efficiently. So, go ahead and try it out, start decluttering your Tmux sessions, and boost your productivity. Stick around for more Tmux tips and tricks!
You can also check out the complete tmux cheatsheet of keyboard shortcuts and mouse shortcuts.