Home Terminal Tuts The Ultimate Tmux Cheat Sheet for Everyone

The Ultimate Tmux Cheat Sheet for Everyone

Unlock the full potential of Tmux with this comprehensive 2024 cheat sheet. From session management to window and pane controls, this guide covers all the crucial commands you need to navigate and customize Tmux like a pro, making your terminal work more efficient and organized.

by John Horan
Published: Updated:
tmux cheat sheet

If you’re a Linux user, you must have found yourself working with multiple terminal sessions at once. This can be a daunting task, especially when you’re trying to manage different tasks simultaneously. To make this process easier, you can use Tmux, a powerful tool that allows you to manage multiple terminal sessions within a single window. Whether you’re a seasoned developer or new to Linux, mastering Tmux can significantly improve your productivity.

To make it easier for you, we have compiled a cheat sheet that contains a plethora of Tmux commands organized by category, so you can easily reference and use Tmux to its full potential.

Tmux Cheat Sheet [2024 edition]

Before diving into the various commands, let’s ensure you’re familiar with the basics of Tmux:

Command Description
tmux Start a new Tmux session.
tmux new -s <session-name> Start a new Tmux session with a specific name.
tmux ls List existing Tmux sessions.
tmux attach -t <session-name> Attach to an existing Tmux session.
tmux kill-session -t <session-name> Terminate a Tmux session.

Navigating Sessions and Windows

Tmux allows you to organize your work into sessions and windows, making it easy to switch between different tasks:

Command Description
Ctrl-b c Create a new window.
Ctrl-b , Rename the current window.
Ctrl-b w List all windows and navigate with arrow keys.
Ctrl-b <window number> Switch to a specific window.
Ctrl-b p Switch to the previous window.
Ctrl-b n Switch to the next window.
Ctrl-b & Close the current window.
Ctrl-b d Detach from the current session.

Pane Management

With Tmux, you can split your terminal window into multiple panes, allowing you to work on different tasks simultaneously:

Command Description
Ctrl-b % Split the current pane vertically.
Ctrl-b " Split the current pane horizontally.
Ctrl-b <arrow> Navigate between panes.
Ctrl-b z Zoom in on the current pane.
Ctrl-b x Close the current pane.
Ctrl-b ! Move the current pane to a new window.

Customization and Configuration

Tmux is highly customizable, allowing you to tailor it to your specific workflow:

Command Description
Ctrl-b : Enter command mode.
Ctrl-b [ Enter scroll mode.
Ctrl-b ? Display a list of key bindings.
tmux source-file <file> Load Tmux configuration from a file.

Copy Mode and Clipboard

Tmux provides a convenient way to copy and paste text within terminal sessions:

Command Description
Ctrl-b [ Enter copy mode.
Ctrl-b PgUp Scroll up in copy mode.
Ctrl-b PgDown Scroll down in copy mode.
Ctrl-b Ctrl-] Paste the most recently copied text.
Ctrl-b = List paste buffers.

Session Management

Advanced commands for managing Tmux sessions:

Command Description
tmux new-session -s <session-name> Create a new Tmux session with a specific name.
tmux switch -t <session-name> Switch to a different Tmux session.
tmux detach-client -s <session-name> Detach all clients from a session.
tmux kill-session -t <session-name> Terminate a Tmux session.

Miscellaneous

Additional handy commands for various Tmux tasks:

Command Description
Ctrl-b :resize-pane -U Resize the current pane upward.
Ctrl-b :resize-pane -D Resize the current pane downward.
Ctrl-b :resize-pane -L Resize the current pane to the left.
Ctrl-b :resize-pane -R Resize the current pane to the right.
Ctrl-b :resize-pane <size> Resize the current pane to a specific size.
Ctrl-b , Rename the current window.
Ctrl-b $ Rename the current session.
Ctrl-b ! Move the current pane into a new window.
Ctrl-b t Display the time in the status bar.

Renaming and Managing Panes

Commands for renaming and managing panes within Tmux:

Command Description
Ctrl-b , Rename the current window.
Ctrl-b % Split the current pane vertically.
Ctrl-b " Split the current pane horizontally.
Ctrl-b ! Move the current pane to a new window.
Ctrl-b ; Toggle between the current and previous active pane.

Status Bar and Key Bindings

Customizing the status bar and key bindings for a personalized Tmux experience:

Command Description
Ctrl-b :set-option status <value> Customize the status bar.
Ctrl-b :set-option prefix <key> Change the prefix key.
Ctrl-b :unbind-key <key> Unbind a key from its default function.
Ctrl-b :bind-key <key> <command> Bind a key to a specific command.

Sharing Sessions

Sharing Tmux sessions with other users for collaborative work:

Command Description
tmux attach-session -t <session-name> Attach to a shared Tmux session.
tmux set-option -g allow-rename off Disable renaming of windows and sessions.

Managing Tmux Environment

Commands for managing Tmux environment and configuration:

Command Description
tmux source-file ~/.tmux.conf Reload Tmux configuration file.
tmux show-options -g Display global Tmux options.
tmux show-options -s Display session-specific Tmux options.

Session and Window Navigation

Commands for navigating between sessions and windows with ease:

Command Description
tmux switch -t <session-name> Switch to a specific Tmux session.
tmux list-windows List all windows in the current session.
tmux select-window -t <window-number> Select a window by its number.
tmux last-window Switch to the previously active window.
tmux next-window Switch to the next window in the session.
tmux previous-window Switch to the previous window in the session.

Window and Session Information

Commands to display information about windows and sessions:

Command Description
tmux display-message "<message>" Display a message in the status line.
tmux list-sessions List all Tmux sessions.
tmux display-message -p "#{window_name}" Display the name of the current window.
tmux display-message -p "#{session_name}" Display the name of the current session.

Clipboard Integration

Commands for integrating Tmux with the system clipboard:

Command Description
tmux set-option -g mouse on Enable mouse support in Tmux.
`tmux save-buffer – xclip -selection clipboard`
`tmux save-buffer – xclip -selection clipboard -o`

Customizing Appearance

Commands for customizing the appearance of Tmux windows and panes:

Command Description
tmux set-option -g status-bg <color> Set the background color of the status bar.
tmux set-option -g status-fg <color> Set the foreground color of the status bar.
tmux set-option -g pane-border-bg <color> Set the background color of pane borders.
tmux set-option -g pane-border-fg <color> Set the foreground color of pane borders.

Personal Insights

In my daily usage of Tmux, I’ve found these additional commands particularly useful for managing multiple sessions and windows efficiently. The ability to navigate swiftly between sessions and gather information about them has been instrumental in maintaining a well-organized workflow.

Moreover, integrating Tmux with the system clipboard has streamlined my copy-paste operations, allowing for seamless transfer of text between Tmux and other applications.

Conclusion

This comprehensive Tmux cheat sheet equips you with an extensive array of commands to master the art of terminal multiplexing. From basic session management to advanced customization options, each command serves as a building block towards maximizing your productivity and efficiency within the terminal environment. By familiarizing yourself with these commands and integrating them into your workflow, you’ll gain the ability to seamlessly navigate between sessions, manage windows and panes effortlessly, and customize Tmux to suit your unique preferences.

You may also like

Leave a Comment

fl_logo_v3_footer

ENHANCE YOUR LINUX EXPERIENCE.



FOSS Linux is a leading resource for Linux enthusiasts and professionals alike. With a focus on providing the best Linux tutorials, open-source apps, news, and reviews written by team of expert authors. FOSS Linux is the go-to source for all things Linux.

Whether you’re a beginner or an experienced user, FOSS Linux has something for everyone.

Follow Us

Subscribe

©2016-2023 FOSS LINUX

A PART OF VIBRANT LEAF MEDIA COMPANY.

ALL RIGHTS RESERVED.

“Linux” is the registered trademark by Linus Torvalds in the U.S. and other countries.