---
title: Write data with the influx CLI
description: Use the influx write command to write data to InfluxDB from the command line.
url: https://docs.influxdata.com/influxdb/v2/write-data/developer-tools/influx-cli/
estimated_tokens: 676
product: InfluxDB OSS v2
version: v2
publisher: InfluxData
canonical: https://docs.influxdata.com/influxdb/v2/write-data/developer-tools/influx-cli/
date: '2023-09-12T23:33:31-06:00'
lastmod: '2023-09-12T23:33:31-06:00'
---

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).

To write data from the command line, use the [`influx write` command](/influxdb/v2/reference/cli/influx/write/).
Include the following in your command:

|Requirement |                                            Include by                                            |
|------------|--------------------------------------------------------------------------------------------------|
|Organization|                            Use the `-o`,`--org`, or `--org-id` flags.                            |
|   Bucket   |                        Use the `-b`, `--bucket`, or `--bucket-id` flags.                         |
| Precision  |                                Use the `-p`, `--precision` flag.                                 |
| API token  |           Set the `INFLUX_TOKEN` environment variable or use the `t`, `--token` flag.            |
|    Data    |Write data using **line protocol** or **annotated CSV**. Pass a file with the `-f`, `--file` flag.|

*See [Line protocol](/influxdb/v2/reference/syntax/line-protocol/) and [Annotated CSV](/influxdb/v2/reference/syntax/annotated-csv)*

#### Example influx write commands

##### Write a single line of line protocol

```sh
influx write \
  -b bucketName \
  -o orgName \
  -p s \
  'myMeasurement,host=myHost testField="testData" 1556896326'
```

##### Write line protocol from a file

```sh
influx write \
  -b bucketName \
  -o orgName \
  -p s \
  --format=lp
  -f /path/to/line-protocol.txt
```

##### Write annotated CSV from a file

```sh
influx write \
  -b bucketName \
  -o orgName \
  -p s \
  --format=csv
  -f /path/to/data.csv
```

#### Related

* [Write CSV data to InfluxDB](/influxdb/v2/write-data/developer-tools/csv/)
| Requirement | Include by |
| --- | --- |
| Requirement | Include by |
| Organization | Use the  -o , --org , or  --org-id  flags. |
| Bucket | Use the  -b ,  --bucket , or  --bucket-id  flags. |
| Precision | Use the  -p ,  --precision  flag. |
| API token | Set the  INFLUX_TOKEN  environment variable or use the  t ,  --token  flag. |
| Data | Write data using  line protocol  or  annotated CSV . Pass a file with the  -f ,  --file  flag. |
