tmux new-session
The tmux new-session command (or its shorthand tmux new) is how you create a new tmux session. A session is a persistent workspace — it keeps running even after you close your terminal or disconnect from a remote machine. Everything you do in tmux happens inside a session.
The most important flag is -s, which lets you name your session. Named sessions are far easier to manage when you have several running:
tmux new -s work
This creates a session called "work" and drops you straight into it. You'll notice the green status bar at the bottom — that's tmux telling you you're inside a session. The session name appears in the bottom-left corner.
You can also create a session that starts in a specific directory:
tmux new -s project -c ~/Code/myproject
Or create a session without attaching to it (useful in scripts):
tmux new -d -s background
Try It Now
- Open your terminal and run:
tmux new -s practice - You're now inside a tmux session called "practice"
- Run any command — try
lsorecho "hello from tmux" - Look at the status bar at the bottom — you'll see
[practice]on the left and the window name on the right - To leave (without stopping the session), press Ctrl-b then d — that's the detach shortcut you'll learn next
If tmux isn't installed, you can install it with:
- macOS:
brew install tmux - Ubuntu/Debian:
sudo apt install tmux - Fedora:
sudo dnf install tmux
Related Features
- Detach from session — Leave this session running in the background so you can come back later
- tmux attach — Reconnect to a session after detaching
- tmux list-sessions — See all your running sessions at a glance