---
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/cloud/write-data/developer-tools/influx-cli/
estimated_tokens: 536
product: InfluxDB Cloud (TSM)
version: cloud
publisher: InfluxData
canonical: https://docs.influxdata.com/influxdb/cloud/write-data/developer-tools/influx-cli/
date: '2021-08-10T12:08:35-05:00'
lastmod: '2021-08-10T12:08:35-05:00'
---

To write data from the command line, use the [`influx write` command](/influxdb/cloud/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/cloud/reference/syntax/line-protocol/) and [Annotated CSV](/influxdb/cloud/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/cloud/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. |
