Tmux: Mastering Your Terminal with a Powerful Multiplexer

Tmux: Mastering Your Terminal with a Powerful Multiplexer

·

2 min read

Introduction

If you spend a significant amount of time working in the terminal, tmux is a tool that can dramatically boost your productivity and workflow. It's a terminal multiplexer, allowing you to create multiple sessions, windows, and panes within a single terminal window. This means you can run multiple tasks simultaneously, switch between them effortlessly, and continue working even after disconnecting from a remote session.

Commonly Used Commands and Shortcut Keys

1. Starting a New Session:

  • tmux new -s <session_name> (optionally specify a name)

2. Detaching from a Session:

  • Ctrl+b d (press Control and b together, then release and press d)

3. Attaching to a Session:

  • tmux attach -t <session_name>

4. Creating a New Window:

  • Ctrl+b c

5. Switching Between Windows:

  • Ctrl+b <window_number> (e.g., Ctrl+b 1)

  • Ctrl+b p (previous window)

  • Ctrl+b n (next window)

6. Splitting a Window into Panes:

  • Ctrl+b % (vertical split)

  • Ctrl+b '"' (horizontal split)

7. Navigating Between Panes:

  • Ctrl+b <arrow keys>

8. Resizing Panes:

  • Ctrl+b <prefix> <arrow keys> (e.g., Ctrl+b Ctrl+Up to increase pane height)

9. Closing a Pane:

  • Ctrl+b x

10. Closing a Window:

  • Ctrl+b &

11. Killing a Session:

  • tmux kill-session -t <session_name>

12. Listing Active Sessions:

  • tmux ls

Additional Tips:

  • Customizing Key Bindings: Customize tmux's key bindings to match your preferences by editing the ~/.tmux.conf file.

  • Using Plugins: Expand tmux's functionality with plugins, such as those for status bars, themes, and session management.

  • Learning More: tmux offers a wealth of features beyond these basics. Explore its documentation and online resources to discover its full potential and further enhance your terminal experience.

Detailed Reference: Home · tmux/tmux Wiki (github.com)