⌘+k ctrl+k
1.5 (current)
Search Shortcut cmd + k | ctrl + k
Friendly CLI

Along with our Friendly SQL, we provide friendly CLI features.

Dark/Light Mode

The CLI automatically detects whether the terminal is using a dark or light background and adjusts syntax highlighting colors accordingly. The mode can also be set manually using the .highlight_mode command:

.highlight_mode dark
.highlight_mode light

To use a mix of colors suitable for both dark and light backgrounds:

.highlight_mode mixed

8-Bit Colors

Since DuckDB v1.5, the CLI supports 8-bit colors corresponding to Xterm system colors:

.display_colors
darkred1 red darkred2 red3 red4 red1 brightred indianred1 ...

Dynamic Prompt

The default prompts are the following:

-- macOS / Linux
{max_length:40}{color:38,5,208}{color:bold}{setting:current_database_and_schema}{color:reset} D 
-- Windows
{max_length:40}{color:green}{color:bold}{setting:current_database_and_schema}{color:reset} D 

Return the Result of the Last Query Using _

You can use the _ (underscore) table to query the result of the last query:

SELECT 42 AS x;
┌───────┐
│   x   │
│ int32 │
├───────┤
│    42 │
└───────┘
FROM _;
┌───────┐
│   x   │
│ int32 │
├───────┤
│    42 │
└───────┘

If the last query did not return a result (e.g., because it performed an update operation), the CLI throws an error:

Binder Error:
Failed to query last result "_": no result available
© 2026 DuckDB Foundation, Amsterdam NL
Code of Conduct Trademark Use Blog