1# CLI Reference
2
3Zed includes a command-line interface for opening files, directories, and controlling the editor from your terminal.
4
5## Installation
6
7- **macOS**: Run `cli: install` from the command palette to create a symlink at `/usr/local/bin/zed`
8- **Linux**: The CLI is included with your distribution's Zed package (binary name may vary)
9
10## Usage
11
12```sh
13zed [OPTIONS] [PATHS...]
14```
15
16## Common Commands
17
18| Command | Description |
19|---------|-------------|
20| `zed` | Open an empty Zed window |
21| `zed .` | Open the current directory as a project |
22| `zed /path/to/file` | Open a specific file |
23| `zed /path/to/folder` | Open a folder as a project |
24| `zed file1.rs file2.rs` | Open multiple files |
25| `zed -n /path` | Open in a new window |
26| `ps aux \| zed -` | Read from stdin |
27
28## Options
29
30| Option | Description |
31|--------|-------------|
32| `-n`, `--new` | Open in a new window instead of reusing an existing one |
33| `-w`, `--wait` | Wait for the file to be closed before returning |
34| `-a`, `--add` | Add files to the current workspace |
35| `-` | Read from stdin |
36| `--foreground` | Start Zed with logs output to the terminal |
37| `--dev-server-token <TOKEN>` | Start as a dev server with the given token |
38| `--uninstall` | Uninstall Zed and all related files |
39| `-h`, `--help` | Show help information |
40| `-v`, `--version` | Show version information |
41
42## Opening Files at a Specific Line
43
44You can open a file at a specific line and column:
45
46```sh
47zed /path/to/file:42 # Open at line 42
48zed /path/to/file:42:10 # Open at line 42, column 10
49```
50
51## Examples
52
53Open the current directory in Zed:
54
55```sh
56zed .
57```
58
59Open a file and wait for it to close (useful for Git commit messages):
60
61```sh
62GIT_EDITOR="zed -w" git commit
63```
64
65Pipe command output into Zed:
66
67```sh
68cat /var/log/system.log | zed -
69```
70
71Open multiple files in a new window:
72
73```sh
74zed -n src/main.rs src/lib.rs
75```