Client APIs
Using the `.help` Command
The `.help` text may be filtered by passing in a text string as the second argument.  
```text
.help m
```  
```text
.maxrows COUNT      Sets the maximum number of rows for display (default: 40). Only for duckbox mode.
.maxwidth COUNT     Sets the maximum width in characters. 0 defaults to terminal width. Only for duckbox mode.
.mode MODE ?TABLE?  Set output mode
```  
#### `.output`: Writing Results to a File {#docs:api:cli:dot_commands::output-writing-results-to-a-file}  
By default, the DuckDB CLI sends results to the terminal's standard output. However, this can be modified using either the `.output` or `.once` commands. Pass in the desired output file location as a parameter. The `.once` command will only output the next set of results and then revert to standard out, but `.output` will redirect all subsequent output to that file location. Note that each result will overwrite the entire file at that destination. To revert back to standard output, enter `.output` with no file parameter.  
In this example, the output format is changed to `markdown`, the destination is identified as a Markdown file, and then DuckDB will write the output of the SQL statement to that file. Output is then reverted to standard output using `.output` with no parameter.  
```sql
.mode markdown
.output my_results.md
SELECT 'taking flight' AS output_column;
.output
SELECT 'back to the terminal' AS displayed_column;
```  
The file `my_results.md` will then contain:  
```text
| output_column |
|---------------|
| taking flight |
```  
The terminal will then display:  
```text
|   displayed_column   |
|----------------------|
| back to the terminal |
```  
A common output format is CSV, or comma separated values. DuckDB supports [SQL syntax to export data as CSV or Parquet](#docs:sql:statements:copy::copy-to), but the CLI-specific commands may be used to write a CSV instead if desired.  
```sql
.mode csv
.once my_output_file.csv
SELECT 1 AS col_1, 2 AS col_2
UNION ALL
SELECT 10 AS col1, 20 AS col_2;
```  
The file `my_output_file.csv` will then contain:  
```csv
col_1,col_2
1,2
10,20
```  
By passing special options (flags) to the `.once` command, query results can also be sent to a temporary file and automatically opened in the user's default program. Use either the `-e` flag for a text file (opened in the default text editor), or the `-x` flag for a CSV file (opened in the default spreadsheet editor). This is useful for more detailed inspection of query results, especially if there is a relatively large result set. The `.excel` command is equivalent to `.once -x`.  
```sql
.once -e
SELECT 'quack' AS hello;
```  
The results then open in the default text file editor of the system, for example:  
<img src="/images/cli_docs_output_to_text_editor.jpg" alt="cli_docs_output_to_text_editor" title="Output to text editor" style="width:293px;"/>