---
title: Use the influx query command
description: Query InfluxDB using the influx CLI. Discover how to query data in InfluxDB 2.1 using influx query.
url: https://docs.influxdata.com/influxdb/v2/query-data/execute-queries/influx-query/
estimated_tokens: 848
product: InfluxDB OSS v2
version: v2
---

# Use the influx query command

This page documents an earlier version of InfluxDB OSS. [InfluxDB 3 Core](/influxdb3/core/) is the latest stable version.

#### API token hashing is enabled by default in InfluxDB OSS 2.9.0

Stronger token security: tokens are stored as hashes on disk, so a copy of the database file doesn’t expose usable tokens. Existing tokens are hashed on first startup and the original strings can’t be recovered afterward — **capture any plaintext tokens you still need before you upgrade**.

For more information, see [Token hashing](/influxdb/v2/admin/tokens/#token-hashing).

Use the [`influx query` command](/influxdb/v2/reference/cli/influx/query) to query data in InfluxDB using Flux. Pass Flux queries to the command as either a file or via stdin.

###### Run a query from a file

```bash
influx query --file /path/to/query.flux
```

###### Pass raw Flux via stdin pipe

```bash
influx query - # Return to open the pipe

data = from(bucket: "example-bucket") |> range(start: -10m) # ...
# Linux & macOS: <ctrl-d> to close the pipe and submit the command
# Windows: <enter>, then <ctrl-d>, then <enter> to close the pipe and submit the command
```

#### Remove unnecessary columns in large datasets

When using the `influx query` command to query and download large datasets, drop columns such as `_start` and `_stop` to optimize the download file size.

```js
// ...
    |> drop(columns: ["_start", "_stop"])
```

#### Related

-   [influx query](/influxdb/v2/reference/cli/influx/query/)

[query](/influxdb/v2/tags/query/)
