---
title: "Open from the command line"
url: "/docs/reference/command-line"
description: "Open files, lines, worktrees and Claude tabs in 10nx from Terminal or a script"
---

# Open from the command line

10nx opens files and worktrees from Terminal through macOS's `open` command. This is also how the tnx skills open things for Claude.

Use this page when you want a script, an alias or another tool to send something to 10nx.

## Open a file

```bash
open -a 10nx notes/plan.md
```

10nx routes it to a workspace:

- **The file's workspace has a window open:** that window comes forward and opens the file.
- **It has no window open:** a new window opens at that workspace and file.
- **The file is in no workspace:** it opens in the last window you used, as an outside file. It reads and saves normally; it just isn't in the tree.

Finder's **Open With › 10nx** does the same.

## Open at a line or heading

Pass flags after `--args`. macOS drops `--args` when the app is already running, so add `-n`: it starts a second copy that hands its flags to the running 10nx and quits at once.

```bash
open -n -a 10nx --args --tnx-open-file="$PWD/src/app.py" --tnx-open-line=42
open -n -a 10nx --args --tnx-open-file="$PWD/notes/plan.md" --tnx-open-heading="Open questions"
```

## Open a worktree

```bash
open -n -a 10nx --args --tnx-open-worktree="$PWD/.claude/worktrees/fix-login"
open -n -a 10nx --args --tnx-open-worktree="$PWD/.claude/worktrees/fix-login" --tnx-open-terminal=claude
```

The window that holds the repo switches to the worktree. `--tnx-open-terminal=claude` (or `=shell`) also opens a tab there.

## Start a Claude tab with a task

```bash
open -n -a 10nx --args \
  --tnx-open-worktree="$PWD/.claude/worktrees/fix-login" \
  --tnx-open-terminal=claude \
  --tnx-open-name=fix-login \
  --tnx-open-prompt="Fix the login redirect loop described in issue 42"
```

The tab's Claude session is named `fix-login`, so other Claude sessions can find it and message it, and it starts on the prompt. The name is letters, digits, `.`, `_` and `-`, up to 64 characters. The prompt is up to 4,096 characters, and is used only when the tab is created.

## All the flags

| Flag | Does |
| --- | --- |
| `--tnx-open-file=<path>` | Open a file |
| `--tnx-open-line=<n>` | With `--tnx-open-file`: go to a line |
| `--tnx-open-heading=<text>` | With `--tnx-open-file`: go to a heading |
| `--tnx-open-worktree=<folder>` | Switch to a worktree |
| `--tnx-open-terminal=claude\|shell` | With `--tnx-open-worktree`: open a tab there |
| `--tnx-open-name=<name>` | Name the new Claude session |
| `--tnx-open-prompt=<text>` | Start the new Claude session on this prompt |
| `--tnx-open-resume=<session id>` | Resume a Claude session in the new tab |
| `--tnx-open-workspace=<id>` | Open a workspace's window |

Paths should be absolute. If 10nx isn't running, `open` starts it first.

## Next steps

- [The tnx skill](tnx-skills.md): `/tnx open` and `/tnx wt` use these flags for Claude
- [Workspaces and worktrees](../concepts/workspaces-and-worktrees.md)
- [Run several Claude sessions at once](../guides/parallel-sessions.md)
