<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/6-lesser-known-heroku-cli-commands-you-probably-aren-t-using-eejglznga" -->

---
title: 6 Lesser-Known Heroku CLI Commands You Probably Aren’t Using
description: A rundown of six underused Heroku CLI commands aimed at cutting browser context-switching: exporting config vars to a local .env file with heroku config -s,...
canonical: https://daily.dev/posts/6-lesser-known-heroku-cli-commands-you-probably-aren-t-using-eejglznga
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: 6 Lesser-Known Heroku CLI Commands You Probably Aren’t Using | daily.dev
og:description: A rundown of six underused Heroku CLI commands aimed at cutting browser context-switching: exporting config vars to a local .env file with heroku config -s,...
og:url: https://daily.dev/posts/6-lesser-known-heroku-cli-commands-you-probably-aren-t-using-eejglznga
og:image: https://api.daily.dev/og/posts/eeJGlznGa.png
og:image:alt: 6 Lesser-Known Heroku CLI Commands You Probably Aren’t Using
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.

# 6 Lesser-Known Heroku CLI Commands You Probably Aren’t Using

**[Heroku](https://daily.dev/sources/heroku)** · 7 min read · 0 upvotes · 0 comments

## Summary

A rundown of six underused Heroku CLI commands aimed at cutting browser context-switching: exporting config vars to a local .env file with heroku config -s, inspecting live queries with heroku pg:ps, SSH-like live debugging into a dyno with heroku ps:exec, running background tasks safely with heroku run:detached, enabling tab-completion with heroku autocomplete, and jumping straight to an add-on's dashboard with heroku addons:open.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.heroku.com/blog/6-lesser-known-heroku-cli-commands>

## Questions this post answers

### How do I export Heroku config vars directly into a local .env file?

Run heroku config -s -a your-staging-app > .env to print all active config variables as shell key-value pairs and pipe them into a local .env file, overwriting any existing one. To add a single new variable without overwriting, use heroku config:get CONFIG-VAR-NAME -s -a your-staging-app >> .env to append it instead.

_daily.dev surfaces workflow tips like this for developers streamlining their Heroku setup._

### How can I SSH into a running Heroku dyno for debugging?

Use heroku ps:exec to establish a secure SSH tunnel directly into a running dyno without managing SSH keys or opening firewall ports. Running it plain connects to a random web dyno, while heroku ps:exec --dyno=web.2 targets a specific instance, letting you profile CPU spikes or tail live logs under production load.

_Developers debugging live production issues can find similar terminal workflows on daily.dev._

### How do I run a long Heroku task without it dying if my connection drops?

Use heroku run:detached instead of heroku run so the platform spins up a worker container and runs the process fully in the background, decoupled from your local machine. For example, heroku run:detached rake db:migrate returns a container ID like run.1234, which you can then stream with heroku logs --dyno run.1234 --tail.

_daily.dev helps developers running risky migrations track practical CLI techniques like this._

## Similar posts on daily.dev

- [Modernizing the Command Line: Heroku CLI v11](https://daily.dev/posts/modernizing-the-command-line-heroku-cli-v11-2swwgps9c) · Heroku · 2 upvotes · 0 comments
- [10 Useful Tools and Web Hosting Tricks Every Developer Should Know](https://daily.dev/posts/10-useful-tools-and-web-hosting-tricks-every-developer-should-know-qhldtfycu) · SitePoint · 0 upvotes · 0 comments
- [Top Heroku Alternatives for Deployment in 2026](https://daily.dev/posts/top-heroku-alternatives-for-deployment-in-2026-m7xqbwbvk) · freeCodeCamp · 1 upvotes · 0 comments

---

Tags: [#devops](https://daily.dev/tags/devops), [#productivity](https://daily.dev/tags/productivity), [#postgresql](https://daily.dev/tags/postgresql), [#cli](https://daily.dev/tags/cli), [#heroku](https://daily.dev/tags/heroku)

[View this post on daily.dev](https://daily.dev/posts/6-lesser-known-heroku-cli-commands-you-probably-aren-t-using-eejglznga)

```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":"6 Lesser-Known Heroku CLI Commands You Probably Aren’t Using","url":"https://daily.dev/posts/6-lesser-known-heroku-cli-commands-you-probably-aren-t-using-eejglznga","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/6-lesser-known-heroku-cli-commands-you-probably-aren-t-using-eejglznga"},"datePublished":"2026-08-25T16:39:22.810Z","dateModified":"2026-09-14T07:19:51.357Z","description":"A rundown of six underused Heroku CLI commands aimed at cutting browser context-switching: exporting config vars to a local .env file with heroku config -s,...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/2f6c471c89a0d3dc35c8f49e6e1840bd?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/2f6c471c89a0d3dc35c8f49e6e1840bd?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Heroku","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":"Heroku","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/5211c8775c204d88836fcbf15d73b1b5","url":"https://daily.dev/sources/heroku"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/6-lesser-known-heroku-cli-commands-you-probably-aren-t-using-eejglznga","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"devops,productivity,postgresql,cli,heroku","timeRequired":"PT7M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Heroku","item":"https://daily.dev/sources/heroku"},{"@type":"ListItem","position":3,"name":"6 Lesser-Known Heroku CLI Commands You Probably Aren’t Using"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/6-lesser-known-heroku-cli-commands-you-probably-aren-t-using-eejglznga#faq","mainEntity":[{"@type":"Question","name":"How do I export Heroku config vars directly into a local .env file?","acceptedAnswer":{"@type":"Answer","text":"Run heroku config -s -a your-staging-app \u003e .env to print all active config variables as shell key-value pairs and pipe them into a local .env file, overwriting any existing one. To add a single new variable without overwriting, use heroku config:get CONFIG-VAR-NAME -s -a your-staging-app \u003e\u003e .env to append it instead. daily.dev surfaces workflow tips like this for developers streamlining their Heroku setup."}},{"@type":"Question","name":"How can I SSH into a running Heroku dyno for debugging?","acceptedAnswer":{"@type":"Answer","text":"Use heroku ps:exec to establish a secure SSH tunnel directly into a running dyno without managing SSH keys or opening firewall ports. Running it plain connects to a random web dyno, while heroku ps:exec --dyno=web.2 targets a specific instance, letting you profile CPU spikes or tail live logs under production load. Developers debugging live production issues can find similar terminal workflows on daily.dev."}},{"@type":"Question","name":"How do I run a long Heroku task without it dying if my connection drops?","acceptedAnswer":{"@type":"Answer","text":"Use heroku run:detached instead of heroku run so the platform spins up a worker container and runs the process fully in the background, decoupled from your local machine. For example, heroku run:detached rake db:migrate returns a container ID like run.1234, which you can then stream with heroku logs --dyno run.1234 --tail. daily.dev helps developers running risky migrations track practical CLI techniques like this."}}]}
```

