Esta página se muestra en inglés. Una traducción al español está en curso.
ConfigsMay 29, 2026·3 min de lectura

Concurrently — Run Multiple Commands in Parallel from One Terminal

A CLI utility that runs multiple commands concurrently with prefixed, color-coded output in a single terminal window. Commonly used in package.json scripts to start a dev server and a file watcher side by side.

Listo para agents

Instalación lista para agent

Este activo puede instalarse después de elegir el runtime, revisar el plan y ejecutar el comando correspondiente.

Native · 98/100Política: permitir
Superficie agent
Cualquier agent MCP/CLI
Tipo
Skill
Instalación
Single
Confianza
Confianza: Established
Entrada
Concurrently Overview
Comando de instalación directa
npx -y tokrepo@latest install 540bfd80-5b7b-11f1-9bc6-00163e2b0d79 --target codex

Ejecutar después de confirmar el plan con dry-run.

Introduction

Concurrently is a Node.js CLI tool that runs multiple commands simultaneously in a single terminal session. It color-codes and prefixes each command's output so you can distinguish between processes at a glance. It is widely used in package.json scripts to start frontend and backend servers, file watchers, and build processes together.

What Concurrently Does

  • Launches multiple shell commands in parallel from a single invocation
  • Prefixes each command's stdout and stderr with a customizable name and color
  • Supports npm script shorthand (npm:dev, npm:build) to run package.json scripts by name
  • Kills all running processes when one exits, or keeps the rest alive based on configuration
  • Returns a combined exit code based on configurable success/failure conditions

Architecture Overview

Concurrently spawns child processes using Node.js's child_process.spawn for each command. Each process's stdout and stderr streams are piped through a transform that prepends a colored prefix. A controller monitors process lifecycle events and applies the configured kill/restart policy. The tool supports running commands from package.json by resolving script names via npm's internal script runner.

Self-Hosting & Configuration

  • Install as a dev dependency with npm install -D concurrently or run ad-hoc with npx
  • Use -n to assign custom names and -c to assign specific colors to each command
  • Set --kill-others to terminate all commands if any one exits
  • Set --kill-others-on-fail to only kill siblings when a command exits with a non-zero code
  • Use --prefix-colors with ANSI color names or hex codes for custom styling

Key Features

  • Color-coded, prefixed output makes it easy to identify which process produced each log line
  • npm script shorthand (npm:* wildcards) runs matching package.json scripts without repeating npm run
  • Configurable kill and restart policies for managing dependent processes
  • Works on Linux, macOS, and Windows including Git Bash and PowerShell
  • Lightweight with no native dependencies

Comparison with Similar Tools

  • npm-run-all — runs npm scripts sequentially or in parallel; concurrently offers richer output formatting and process control
  • GNU Parallel — powerful parallel command executor for shell; heavier and not designed for npm script workflows
  • Mprocs — TUI-based process manager with split panes; concurrently uses a single merged output stream
  • Foreman / Overmind — Procfile-based process managers; concurrently is simpler and works inline in npm scripts

FAQ

Q: Can I restart a command if it crashes? A: Yes, use the --restart-tries and --restart-after flags to configure automatic restart behavior for failing commands.

Q: How do I run all npm scripts matching a pattern? A: Use the npm:* wildcard syntax, for example concurrently "npm:watch-*" runs all scripts whose names start with watch-.

Q: Does concurrently work on Windows? A: Yes, it supports Windows natively including cmd.exe, PowerShell, and Git Bash.

Q: How do I control the exit code? A: Use --success to define which command's exit code determines the overall result: first, last, all, or a specific command index.

Sources

Discusión

Inicia sesión para unirte a la discusión.
Aún no hay comentarios. Sé el primero en compartir tus ideas.

Activos relacionados