How to create a new window in tmux?

Quick Answer

To create a new window in tmux, press Ctrl+b followed by c. You can also use the command tmux new-window or its shorthand tmux neww.

Ctrl+b+c

Detailed Explanation

Windows in tmux are similar to tabs in a browser. They allow you to have multiple terminal views within a single tmux session. Each window can have its own layout, commands, and purpose, making it easy to organize your work.

Creating windows with keyboard shortcuts:

  • Ctrl+b c - Create a new window with default name
  • Ctrl+b , - Rename the current window
  • Ctrl+b & - Kill the current window (with confirmation)

Creating windows with commands:

  • tmux new-window or tmux neww - Create a new window
  • tmux new-window -n name - Create a window with specified name
  • tmux new-window -c /path/to/dir - Create window in specific directory
  • tmux new-window command - Create window and run command

Navigating between windows:

  • Ctrl+b n - Next window
  • Ctrl+b p - Previous window
  • Ctrl+b 0-9 - Go to window by number (0-9)
  • Ctrl+b w - Choose window from a list
  • Ctrl+b f - Find window by name

Managing windows:

  • Ctrl+b . - Move window to a different index
  • Ctrl+b l - Switch to the last active window
  • Ctrl+b ' - Prompt for a window index to select

Pro Tip

Use tmux new-window -d 'command' to create a new window in the background running a specific command. This is useful for starting long-running processes without switching away from your current window.