Cursor code/cursor Command
Cursor is a modern code editor built on Visual Studio Code (VS Code), so it inherits VS Code's powerful features, such as the code command introduced in this article.
In Visual Studio Code, the code or cursor command is a command-line tool used to quickly open VS Code and perform code-related operations.
The code command helps developers launch VS Code directly from a terminal or command prompt, or handle specific tasks.
The most common way is to use the code or cursor command to open a file or directory directly from the command line; the code command must be installed first.
Cursor supports setting the terminal launch command to code or cursor for quick editor startup. If VS Code is already installed locally, the code command is generally used in VS Code, while Cursor uses the cursor command.
Enabling Cursor's code command is very simple; first open the command palette:
- macOS shortcut: Shift+Cmd+P (command + shift + p)
- Windows/Linux shortcut: Ctrl + Shift + P
Search for and install >shell command:

Then select 'Install "cursor" command in PATH' - Shell Command: Install 'cursor' command in PATH to add the cursor command reference to the system PATH.
We can open files, install extensions, change the display language, and even view diagnostic information via the command line.
View version information with cursor --version:
# cursor --version
0.45.14
906121b8c0bdf041c14a15dac228e66ab5505260
arm64
The following are some commonly used command-line options, which can be viewed with the cursor --help command:
Cursor 0.45.14
Usage: cursor [options][paths...]
To read from stdin, append '-' (e.g. 'ps aux | grep code | cursor -')
Options
-d --diff Compare two files with each
other.
-m --merge Perform a three-way merge by
providing paths for two modified
versions of a file, the common
origin of both modified versions
and the output file to save merge
results.
-a --add Add folder(s) to the last active
window.
-g --goto Open a file at the path on the
specified line and character
position.
-n --new-window Force to open a new window.
-r --reuse-window Force to open a file or folder in
an already opened window.
-w --wait Wait for the files to be closed
before returning.
--locale The locale to use (e.g. en-US or
zh-TW).
--user-data-dir Specifies the directory that user
data is kept in. Can be used to
open multiple distinct instances
of Code.
--profile Opens the provided folder or
workspace with the given profile
and associates the profile with
the workspace. If the profile
does not exist, a new empty one
is created.
-h --help Print usage.
We can use the cursor . command in the terminal to open a folder in Cursor:

| Command | Description |
|---|---|
code <路径> |
Open a file or folder |
cursor . |
Open the current directory as a workspace |
cursor --new-window |
Open in a new window |
cursor --diff |
Compare the contents of two files |
cursor --wait |
Wait for the window to close before returning to the terminal |
cursor --disable-extensions |
Run VS Code with all extensions disabled |
cursor --install-extension <扩展名> |
Install a specified extension |
cursor --list-extensions |
List all installed extensions |
cursor --uninstall-extension <扩展名> |
Uninstall a specified extension |