code) is a powerful command-line tool that allows you to control and interact with VS Code from the terminal. It provides functionality for opening files and folders, managing extensions, creating remote tunnels, and much more.
What is the VS Code CLI?
The VS Code CLI is a Rust-based command-line interface that serves as the entry point for launching and controlling Visual Studio Code. It can:- Launch VS Code with specific files, folders, or workspaces
- Manage extensions (install, uninstall, list)
- Create secure remote tunnels for accessing your machine from anywhere
- Run a local web version of VS Code
- Switch between different VS Code versions (stable, insiders, or specific versions)
- Configure editor settings and troubleshoot issues
The CLI is designed to work with both standalone installations and integrated VS Code installations.
Key Features
Remote Tunnels
Create secure tunnels to access your development environment from vscode.dev or any browser, from anywhere in the world.
Extension Management
Install, uninstall, list, and update extensions directly from the command line.
Version Management
Switch between stable, insiders, or specific versions of VS Code seamlessly.
Local Web Server
Run a local web version of VS Code for browser-based development.
Basic Usage
The basic syntax for using the VS Code CLI is:Opening Files and Folders
Quick Examples
Command Categories
The CLI is organized into several main command categories:Core Commands
- No subcommand - Launch VS Code with files/folders
status- Print process usage and diagnosticsversion- Manage VS Code versions
Extension Commands
ext list- List installed extensionsext install- Install extensionsext uninstall- Uninstall extensionsext update- Update extensions
Tunnel Commands
tunnel- Create and manage remote tunnelstunnel service- Manage tunnel as a system servicetunnel user- Manage authentication for tunnels
Web Commands
serve-web- Run a local web version of VS Code
For detailed information about each command, see the Commands Reference page.
Global Options
These options can be used with any command:Print verbose output (implies —wait)
Log level to use. Values:
off, critical, error, warn, info, debug, traceDirectory where CLI metadata should be stored
Disable telemetry for the current command
Sets the initial telemetry level. Values:
off, crash, error, allArchitecture
The VS Code CLI is built with:- Language: Rust
- Binary name:
code(orcode-cliinternally) - Command parsing: clap library for robust CLI argument parsing
- Async runtime: tokio for asynchronous operations
- Tunneling: Microsoft Dev Tunnels for secure remote access
Output Formats
Many commands support both text and JSON output formats:Text output (default)
JSON output
Environment Variables
The CLI respects several environment variables:VSCODE_CLI_DATA_DIR- Override the CLI data directoryVSCODE_CLI_ACCESS_TOKEN- Provide access token for authenticationVSCODE_CLI_REFRESH_TOKEN- Provide refresh token for authenticationVSCODE_CLI_REQUIRE_TOKEN- Require token for command shell connectionsVSCODE_CLI_NONINTERACTIVE- Disable interactive promptsNO_COLOR- Disable colored output
Next Steps
Installation
Learn how to install the VS Code CLI on your system
Commands Reference
Explore all available CLI commands and options
Remote Tunnels
Set up secure remote access to your development environment
Configuration
Configure the CLI for your workflow