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 lightTo use a mix of colors suitable for both dark and light backgrounds:
.highlight_mode mixed8-Bit Colors
Since DuckDB v1.5, the CLI supports 8-bit colors corresponding to Xterm system colors:
.display_colorsdarkred1 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} DReturn 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