Salta ai contenuti

mprocs - Esegui Più Comandi in Parallelo Cheatsheet

mprocs - Esegui Più Comandi in Parallelo Cheatsheet

mprocs esegue più comandi a lungo termine contemporaneamente, ognuno nel suo riquadro etichettato con output e scrollback indipendenti, controllati da un singolo TUI. È progettato per la situazione di sviluppo comune in cui dovresti altrimenti aprire più terminali o split tmux per eseguire un server frontend, un backend, un watcher e un database. Definisci i processi una volta in un file di configurazione e avviali insieme.

Installation

PlatformCommand
Cargo (all platforms)cargo install mprocs
macOS (Homebrew)brew install mprocs
npmnpm install -g mprocs
Arch Linux (AUR)yay -S mprocs
Scoop (Windows)scoop install mprocs
Prebuilt binaryDownload from the GitHub Releases page

Basic Usage

CommandDescription
mprocsStart using mprocs.yaml in the current directory
mprocs "npm run dev" "npm run api"Run ad-hoc commands as panes
mprocs -c path/to/mprocs.yamlUse a specific config file
mprocs --names web,api "npm run dev" "cargo run"Name ad-hoc panes
mprocs --helpFull option list

Configuration (mprocs.yaml)

procs:
  web:
    shell: "npm run dev"
  api:
    shell: "cargo run"
  db:
    shell: "docker compose up postgres"
    autostart: false        # start it manually with the UI
  worker:
    cmd: ["python", "worker.py"]
    cwd: "./backend"
    env:
      LOG_LEVEL: debug
FieldPurpose
shellCommand run through the shell
cmdCommand as an argv list (no shell parsing)
cwdWorking directory for the process
envPer-process environment variables
autostartWhether the process starts on launch
stopHow to stop it (SIGTERM, SIGKILL, hard-kill)

Keyboard Controls

KeyAction
Ctrl+a then j/kMove selection down/up the process list
Ctrl+a then sStart the selected process
Ctrl+a then xStop the selected process
Ctrl+a then rRestart the selected process
Ctrl+a then aToggle focus between list and pane (interact with the process)
Ctrl+a then cCopy mode / scroll the pane output
Ctrl+a then qQuit mprocs (stops all processes)
MouseClick a process to select; scroll its output

Il prefisso predefinito è Ctrl+a; è configurabile. Premi il prefisso, rilascia, quindi il tasto azione.

Remote Control

mprocs può essere controllato programmaticamente, il che è utile da script o attività dell”editor.

# Send a command to a running mprocs instance over its control socket
mprocs --ctl '{c: restart-proc, proc: web}'

Common Workflows

# One command to bring up a full local stack defined in mprocs.yaml
mprocs

# Quick throwaway: watch tests and a dev server side by side
mprocs --names test,dev "npm test -- --watch" "npm run dev"

# Keep the database pane present but start it only when needed (autostart: false)

mprocs vs Alternatives

ToolModelBest for
mprocsTUI, one pane per processDev process groups, simple config
tmuxFull terminal multiplexerSessions, splits, remote persistence
foreman/overmindProcfile runnersProcfile-based process management
GNU parallelBatch parallelismRunning many short jobs, not long-lived servers

Resources