surge command launches the Terminal User Interface (TUI) and optionally queues downloads. When a Surge instance is already running, it will show an error and suggest using surge add instead.
Usage
Description
Launches Surge in TUI mode with an embedded HTTP server for browser extension integration. The command:- Starts the interactive Terminal User Interface
- Binds an HTTP API server on the specified port (or auto-selects one)
- Queues any URLs provided as arguments
- Can resume paused downloads from previous sessions (unless
--no-resumeis set) - Runs startup integrity check to validate database and state files
Arguments
One or more URLs to download. URLs can include mirrors using comma separation.Multiple URLs can be provided:
Flags
Path to a file containing URLs to download (one per line).Short form:
-bExample:Port to listen on for HTTP API server. If not specified or set to 0, automatically finds an available port starting from 1700.Short form:
-pExample:Default output directory for downloads. If not specified, uses the configured default download directory from settings.Short form:
-oExample:Do not automatically resume paused downloads from previous sessions on startup.Example:
Exit the TUI automatically when all downloads complete. Useful for scripting.Example:
Examples
Basic Usage
Launch TUI with a single download:Batch Downloads
Queue multiple downloads from a file:urls.txt containing:
With Mirrors
Provide mirror URLs (comma-separated):Custom Port
Run on a specific port:Script Integration
Exit automatically when complete:Startup Behavior
Integrity Check
On startup, Surge performs an integrity check that:- Validates paused/queued download metadata
- Removes entries with missing or corrupted
.surgestate files - Cleans orphaned state files without database entries
Auto-Resume
By default, Surge automatically resumes:- Downloads in “queued” state
- Downloads in “paused” state (if
AutoResumesetting is enabled)
--no-resume to disable this behavior.
Lock File
Surge uses a lock file to prevent multiple instances. The lock is stored in the runtime directory and automatically released on exit.Remote Mode
When--host is specified, surge operates in remote TUI mode:
In remote mode, URLs cannot be passed as arguments. Use
surge add after connecting.Related Commands
- surge add - Add downloads to a running instance
- surge server - Run in headless mode
- surge connect - Connect TUI to remote daemon