Creating a tmux session gives you a persistent workspace that can keep shells, editors, and long-running commands alive even after you leave the terminal. It is the usual starting point when you want one named place to hold related tmux windows and panes.

The new-session command attaches to the new session by default, but -d creates it in the background so the current shell stays where it is. Giving the session a name with -s makes it easy to list, attach, rename, or remove later without guessing which session is which.

Printing the new session with -P gives immediate confirmation that the server accepted the create request, and list-sessions provides a second check that the session now exists. If the chosen name is already in use, tmux rejects the request so you do not accidentally replace another running session.

Steps to create a tmux session:

  1. Create the session with a descriptive name and print the created session identifier.
    $ tmux new-session -d -s work -P
    work:

    The -d flag keeps the current shell in place instead of attaching immediately, and omitting -d opens the new session in the current terminal.

    Add -c /path/to/project when the first window should start in a specific directory rather than the current shell directory.

  2. List the available sessions to confirm that the new session now exists on the tmux server.
    $ tmux list-sessions
    work: 1 windows (created Wed Apr 15 14:29:37 2026)

    Tmux shows the session name, window count, and creation time for each session it knows about.

  3. Choose a different name when tmux reports that the session already exists.
    $ tmux new-session -d -s work
    duplicate session: work

    Session names must be unique on the same tmux server, so reuse a different name or attach to the existing session instead of trying to create it again.