<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/read-and-write-your-realtime-database-with-the-firebase-cli-bhs63s6vt" -->

---
title: Read and write your Realtime Database with the Firebase CLI
description: A walkthrough of using the Firebase CLI to read, write, push, update, and delete data in the Realtime Database directly from the command line, instead of...
canonical: https://daily.dev/posts/read-and-write-your-realtime-database-with-the-firebase-cli-bhs63s6vt
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Read and write your Realtime Database with the Firebase CLI | daily.dev
og:description: A walkthrough of using the Firebase CLI to read, write, push, update, and delete data in the Realtime Database directly from the command line, instead of...
og:url: https://daily.dev/posts/read-and-write-your-realtime-database-with-the-firebase-cli-bhs63s6vt
og:image: https://api.daily.dev/og/posts/BHS63s6vT.png
og:image:alt: Read and write your Realtime Database with the Firebase CLI
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Read and write your Realtime Database with the Firebase CLI

**[Firebase](https://daily.dev/sources/firebase-blog)** · 6 min read · 0 upvotes · 0 comments

## Summary

A walkthrough of using the Firebase CLI to read, write, push, update, and delete data in the Realtime Database directly from the command line, instead of manually editing data through the Firebase console. Covers commands like database:set, database:get, database:push, database:update, and database:remove, along with tips for piping JSON, using flags like --confirm and --pretty, and copying data between projects using a custom bash function.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://firebase.blog/posts/2017/12/read-and-write-your-realtime-database>

## Questions this post answers

### How do I write JSON data to Firebase Realtime Database from the command line?

Use the firebase database:set command, passing the database path and either a JSON file or inline JSON via the --data flag, for example firebase database:set /import --data '{"foo": "bar baz"}'. Single quotes are needed around the JSON on the command line to avoid shell interpretation issues, and JSON can also be piped via stdin using the --confirm flag to skip the overwrite prompt.

_Developers scripting database setup or test environments can find more Firebase CLI patterns on daily.dev._

### How do I copy Firebase Realtime Database data from one project to another?

Pipe the output of firebase database:get on the source project into firebase database:set on the destination project, using the --project flag to specify each project id, such as firebase --project dev database:get / | firebase --project staging database:set / --confirm. This can be wrapped in a bash function like transfer_to(src, dest, path) for repeated use.

_Teams syncing dev and staging data can track Firebase CLI tips like this on daily.dev._

### How do I delete all data in a Firebase Realtime Database using the CLI?

Run firebase database:remove / --confirm, which deletes the entire database unconditionally, similar to rm -rf /. The --confirm flag is required to bypass the interactive confirmation prompt, so this command should be used carefully since it removes all data at the specified path without recovery.

_Anyone scripting destructive database operations can review CLI safety flags like this on daily.dev._

## Similar posts on daily.dev

- [How Firestore Structures Data and How to Perform CRUD Operations With It](https://daily.dev/posts/how-firestore-structures-data-and-how-to-perform-crud-operations-with-it-odioykply) · freeCodeCamp · 1 upvotes · 0 comments
- [Using Flutter with Firebase: A Developer's Guide](https://daily.dev/posts/using-flutter-with-firebase-a-developer-s-guide-jbpavk3vl) · Flutter Community · 0 upvotes · 0 comments
- [Testing Firestore security rules without touching production](https://daily.dev/posts/testing-firestore-security-rules-without-touching-production-hniqyzuq6) · All Things Open · 1 upvotes · 0 comments

---

Tags: [#backend](https://daily.dev/tags/backend), [#cli](https://daily.dev/tags/cli), [#firebase](https://daily.dev/tags/firebase), [#bash](https://daily.dev/tags/bash)

[View this post on daily.dev](https://daily.dev/posts/read-and-write-your-realtime-database-with-the-firebase-cli-bhs63s6vt)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Read and write your Realtime Database with the Firebase CLI","url":"https://daily.dev/posts/read-and-write-your-realtime-database-with-the-firebase-cli-bhs63s6vt","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/read-and-write-your-realtime-database-with-the-firebase-cli-bhs63s6vt"},"datePublished":"2026-08-23T12:18:15.612Z","dateModified":"2026-08-23T12:32:13.002Z","description":"A walkthrough of using the Firebase CLI to read, write, push, update, and delete data in the Realtime Database directly from the command line, instead of...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/7ed721de96163685d26ab7e314be3ebc?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/7ed721de96163685d26ab7e314be3ebc?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Firebase","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Firebase","logo":"https://media.daily.dev/image/upload/s--i395oqZH--/f_auto,q_auto/v1787487448/logos/firebase-blog?_a=BAMAMicg0","url":"https://daily.dev/sources/firebase-blog"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/read-and-write-your-realtime-database-with-the-firebase-cli-bhs63s6vt","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"backend,cli,firebase,bash","timeRequired":"PT6M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Firebase","item":"https://daily.dev/sources/firebase-blog"},{"@type":"ListItem","position":3,"name":"Read and write your Realtime Database with the Firebase CLI"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/read-and-write-your-realtime-database-with-the-firebase-cli-bhs63s6vt#faq","mainEntity":[{"@type":"Question","name":"How do I write JSON data to Firebase Realtime Database from the command line?","acceptedAnswer":{"@type":"Answer","text":"Use the firebase database:set command, passing the database path and either a JSON file or inline JSON via the --data flag, for example firebase database:set /import --data '{\"foo\": \"bar baz\"}'. Single quotes are needed around the JSON on the command line to avoid shell interpretation issues, and JSON can also be piped via stdin using the --confirm flag to skip the overwrite prompt. Developers scripting database setup or test environments can find more Firebase CLI patterns on daily.dev."}},{"@type":"Question","name":"How do I copy Firebase Realtime Database data from one project to another?","acceptedAnswer":{"@type":"Answer","text":"Pipe the output of firebase database:get on the source project into firebase database:set on the destination project, using the --project flag to specify each project id, such as firebase --project dev database:get / | firebase --project staging database:set / --confirm. This can be wrapped in a bash function like transfer_to(src, dest, path) for repeated use. Teams syncing dev and staging data can track Firebase CLI tips like this on daily.dev."}},{"@type":"Question","name":"How do I delete all data in a Firebase Realtime Database using the CLI?","acceptedAnswer":{"@type":"Answer","text":"Run firebase database:remove / --confirm, which deletes the entire database unconditionally, similar to rm -rf /. The --confirm flag is required to bypass the interactive confirmation prompt, so this command should be used carefully since it removes all data at the specified path without recovery. Anyone scripting destructive database operations can review CLI safety flags like this on daily.dev."}}]}
```

