DEV Community

Alex Spinov
Alex Spinov

Posted on

Bun Shell Has a Free API — Run Shell Commands from TypeScript with Zero Dependencies

What if you could write shell scripts in TypeScript — with template literals, piping, and glob support — and they ran faster than bash?

Bun Shell lets you write shell commands directly in TypeScript using tagged template literals.

Why Bun Shell

  • Template literal syntax — write shell commands naturally in TypeScript
  • Cross-platform — works on macOS, Linux, and Windows
  • Built-in globbing — no external packages needed
  • Piping — chain commands with pipe operator
  • Zero dependencies — part of the Bun runtime

Quick Start

import { $ } from "bun";

const result = await $`ls -la`.text();

const dir = "src";
const files = await $`find ${dir} -name "*.ts"`.text();

await $`prettier --write src/**/*.{ts,tsx}`;
Enter fullscreen mode Exit fullscreen mode

Real Use Case

A team rewrote 15 bash CI scripts with Bun Shell. They got type checking, cross-platform support, and ran in half the time.

Get Started

Install bun.sh — Bun Shell is built in, no extra packages.


Need custom data pipelines or scraping solutions? Check out my Apify actors or email me at spinov001@gmail.com for custom solutions.

Top comments (0)