Write data with the influx CLI

This page documents an earlier version of InfluxDB. InfluxDB v2.6 is the latest stable version. View this page in the v2.6 documentation.

To write data from the command line, use the influx write command. Include the following in your command:

RequirementInclude by
OrganizationUse the -o,--org, or --org-id flags.
BucketUse the -b, --bucket, or --bucket-id flags.
PrecisionUse the -p, --precision flag.
API tokenSet the INFLUX_TOKEN environment variable or use the t, --token flag.
DataWrite data using line protocol or annotated CSV. Pass a file with the -f, --file flag.

See Line protocol and Annotated CSV

Example influx write commands

Write a single line of line protocol
influx write \
  -b bucketName \
  -o orgName \
  -p s \
  'myMeasurement,host=myHost testField="testData" 1556896326'
Write line protocol from a file
influx write \
  -b bucketName \
  -o orgName \
  -p s \
  -f /path/to/line-protocol.txt
Write annotated CSV from a file
influx write \
  -b bucketName \
  -o orgName \
  -p s \
  -f /path/to/data.csv

Was this page helpful?

Thank you for your feedback!

Set your InfluxDB URL

Linux Package Signing Key Rotation

All signed InfluxData Linux packages have been resigned with an updated key. If using Linux, you may need to update your package configuration to continue to download and verify InfluxData software packages.

For more information, see the Linux Package Signing Key Rotation blog post.

State of the InfluxDB Cloud (IOx) documentation

The new documentation for InfluxDB Cloud backed by InfluxDB IOx is a work in progress. We are adding new information and content almost daily. Thank you for your patience!

If there is specific information you’re looking for, please submit a documentation issue.