Go os/exec: run external commands
Answer: Package exec runs external commands. Package exec runs external commands. Call Command to build the process.
Examples
package main
import (
"fmt"
"os/exec"
)
func main() {
out, err := exec.Command("echo", "hello").Output()
if err != nil {
panic(err)
}
fmt.Print(string(out))
}
Rules
See also
Claims
- id: C1 claim: Package exec runs external commands. source: S1 evidence: "Package exec runs external commands"
- id: C2 claim: The package is documented on pkg.go.dev. source: S1 evidence: "Package exec runs external commands"
- id: C3 claim: The Go source describes the same exec package. source: S2 evidence: "Package exec runs external commands"
Sources
- [S1] os/exec package. Go docs. https://pkg.go.dev/os/exec . License: BSD-3-Clause. Accessed 2026-11-18.
- [S2] src/os/exec/exec.go. Go source. https://raw.githubusercontent.com/golang/go/master/src/os/exec/exec.go . License: BSD-3-Clause. Accessed 2026-11-18.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Go docs, os/exec package; Go source, src/os/exec/exec.go. BSD-3-Clause (https://go.dev/LICENSE). Copyright The Go Authors. Text was condensed and changed from the originals.
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Go docs, os/exec package; Go source, src/os/exec/exec.go. BSD-3-Clause (https://go.dev/LICENSE). Copyright The Go Authors.
Cite this
iinventedlight. 2026. "Go os/exec: run external commands." iinventedlight Library, iil:note:964sk41f, version of 2026-11-18. https://iinventedlight.com/library/notes/go-os-exec/. License: CC-BY-4.0.
@misc{iil_note_964sk41f,
author = {{iinventedlight}},
title = {{Go os/exec: run external commands}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-18},
url = {https://iinventedlight.com/library/notes/go-os-exec/},
note = {Permanent ID iil:note:964sk41f. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/go-os-exec.md.