liveBook · Manning

DuckDB CLI

As explained in DuckDB in Action

The DuckDB CLI is DuckDB's command-line interface for executing queries and working with query results.

DuckDB CLI is an embedded, serverless command-line interface for running SQL, inspecting results, and processing local or remote data files without a separate database installation. section 2.1 section 2.3

Use the CLI to move from quick exploration to repeatable data pipelines:

  • Launch a transient in-memory database with duckdb, or open a persistent database file. section 2.3
  • Control execution and output with options such as -readonly, -json, -line, -c, and -s. section 2.3.3
  • Query CSV files directly from URLs, including short links handled explicitly with read_csv_auto. section 2.5
  • Pipe standard input and output to create CSV files, or use COPY ... TO to write Parquet. section 2.5.1

Analyze and export a remote CSV

Run `duckdb --json -c 'SELECT count(*) FROM read_csv_auto("https://bit.ly/3KoiZR0");'` to return a machine-readable record count. For a reusable export, run `duckdb -csv -s "SELECT Country, Population, Birthrate, Deathrate FROM read_csv_auto('https://bit.ly/3KoiZR0') WHERE trim(region) = 'WESTERN EUROPE'" > western_europe.csv`. Write Parquet explicitly with `COPY (...) TO 'western_europe.parquet' (FORMAT PARQUET)`. section 2.3.3 section 2.5 section 2.5.1

Listing 2.2 Getting DuckDB running on Linux
wget https://github.com/duckdb/duckdb/releases/download/v0.10.0/\
duckdb_cli-linux-amd64.zip  #1
unzip duckdb_cli-linux-amd64.zip
./duckdb -version

Use the Linux installation listing to download the CLI archive, unpack it, and verify the executable version. section 2.2.2

How DuckDB in Action covers it

How deep it goes
Explains installation, startup, arguments, result modes, remote CSV access, and exports, but does not descend into database internals.
Examples
Demonstrates transient sessions, JSON results, country-population CSV analysis, Western Europe filtering, and CSV or Parquet exports.
What it assumes
Assumes basic SQL and shell familiarity while teaching installation, interactive startup, output modes, and direct file querying.
What you can do after
Apply it via shell commands to query files, format results, and build lightweight data-processing pipelines.
How it connects
Connects embedded databases, SQL, shell pipelines, remote files, CSV, and Parquet.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of DuckDB in Action. The section links point to the parts of the book it draws on.