Tmux is a powerful terminal multiplexer that allows you to have multiple terminal windows open inside one session. It can also be used to detach and reattach sessions so you can access them from different locations. The tmux terminal multiplexer can be a bit daunting to learn, but with this comprehensive cheat sheet, you can get up to speed on tmux in no time.
What is tmux?
Tmux (short for “terminal multiplexer”) is a terminal multiplexer that allows you to have multiple terminal windows open inside one session. It also allows you to easily detach and reattach sessions so you can access them from different locations. Tmux can be used for anything from running long-running processes to managing system administration tasks.
Getting Started with tmux
To get started with tmux, you’ll need to install it on your system. On Linux, you can install it using your package manager. On macOS, you can install it using Homebrew. After it’s installed, you can launch tmux by running the “tmux” command.
Now that you’ve got tmux installed, let’s take a look at some of the basic commands you’ll need to get up and running.
The “new” command will create a new tmux session. You can also specify a name for the session.
The “attach” command will attach you to an existing tmux session.
The “detach” command will detach you from a tmux session.
The “rename” command will rename an existing tmux session.
The “list-sessions” command will list all existing tmux sessions.
The “switch-client” command will switch to another client in the same session.
tmux Windows and Panes
Tmux works by dividing the terminal window into multiple windows and panes. A window is a single view of the terminal, while a pane is a split-screen view of the terminal.
To create a new window, you can use the “new-window” command. To switch between windows, you can use the “switch-window” command.
To create a new pane, you can use the “split-window” command. To switch between panes, you can use the “select-pane” command.
tmux Key Bindings
Tmux also has a number of key bindings that can be used for quickly navigating and manipulating windows and panes.
The “ctrl-b c” key binding will create a new window.
The “ctrl-b n” key binding will switch to the next window.
The “ctrl-b p” key binding will switch to the previous window.
The “ctrl-b “ key binding will split the window into two panes.
The “ctrl-b arrow key” key binding will switch between panes.
By following this cheat sheet, you should now have a good understanding of tmux and how to use it. With a little practice, you’ll be a tmux master in no time.