Skip to main content
Back to Commands
Session ManagementPrefix + :new (command mode)

new-session

Short form: new

Create a new session. If run from inside tmux, the new session is created but not attached. The new session is grouped with the session specified by -t if given, sharing windows and the current window.

Synopsis

bash
tmux new-session [-AdDEPX] [-c start-directory] [-e environment] [-f flags] [-F format] [-n window-name] [-s session-name] [-t group-name] [-x width] [-y height] [shell-command]

Options

FlagDescription
-AAttach to existing session if it exists, otherwise create new
-dDon't attach to the new session
-DDetach any other clients attached to the session
-s session-nameSpecify the session name
-n window-nameName the initial window
-c start-directorySpecify starting directory
-t group-nameGroup with an existing session
-x widthSet window width
-y heightSet window height

Examples

Create a new session with default name

bash
tmux new-session

Create a session named 'dev'

bash
tmux new -s dev

Create session 'work' with window named 'editor'

bash
tmux new -s work -n editor

Create session starting in specific directory

bash
tmux new -s project -c ~/code/myproject

Attach to 'main' if it exists, otherwise create it

bash
tmux new -A -s main

Create a detached session (runs in background)

bash
tmux new -d -s background

Default Keybinding

Prefix + :new (command mode)

Default prefix is Ctrl+b

Pro Tips

  • Use -A flag to create or attach in one command - perfect for scripts
  • The -d flag is useful for creating sessions in startup scripts
  • Session names should be descriptive and short for easy switching