standard output and standard error
The two channels a program writes normal output (stdout) and error messages (stderr) to, plus stdin for input.
In more detail
Every program starts with three streams: standard input (stdin) to read from, standard output (stdout) for normal results and standard error (stderr) for error messages. In a terminal all three are connected to your screen and keyboard, but the shell can connect them to files with redirection or to other programs with a pipe. Keeping errors on a separate stream means they stay visible even when output is saved to a file.
Examples
A registered command result holds what the command printed, so a later task can read id_result.stdout.Factor XI of the twelve-factor app: each process writes its log events, unbuffered, to standard output, and the platform collects and routes them.git commit -a -F - reads the commit message from standard input.echo "commit-msg: subject is not a conventional commit" >&2 writes to standard error.fmt.Fprintln(os.Stderr, "probe: host unreachable")java -version prints to standard error, not standard output.rpk topic produce reads each line of standard input as one record.Every process starts with these three streams as file descriptors 0 (stdin), 1 (stdout) and 2 (stderr). By default they are connected to your terminal, and the shell can redirect them to files or other programs. A process that must keep running after you log out needs its output redirected somewhere, because the terminal it was attached to goes away.The course logger writes one JSON record per line to stdout.In this course: print writes to standard output. pytest captures both streams for each test and shows them in the failure report, unless you run with -s.Related terms
- register — The task keyword that saves a task's result in a named variable so later tasks can read it.
- command module — The module that runs any program you name on the host and reports what it printed, without being able to tell whether it changed anything.
- redirection — Sending a command's output into a file instead of the terminal: > replaces the file, >> appends to the end of it.
- pipe — The | operator, which connects one command's standard output to the next command's standard input so they run together.
- file descriptor — A small number the operating system gives a process for each open file, socket or pipe, used in every later read or write.
- secret masking — The runner's replacement of known secret values with asterisks in job logs.
- docker logs — Shows what a container main process wrote to standard output and standard error.
- logging driver — The part of Docker that decides where container logs go, such as a local file or a central log service.
- process — A program that is currently running, with its own memory and a numeric identifier.
- event stream — A continuous, time-ordered flow of events with no fixed beginning or end.
- unbuffered output — Output that is written out immediately, instead of being held in memory until a buffer fills.
- structured logging — Writing each log entry as named fields, such as status, duration and request identifier, instead of a free-text sentence.
- container — A running program that has been fenced off from the rest of the computer so it only sees its own files, network and processes.
- rpk topic produce — An rpk command that reads lines from standard input and writes each one to a topic as a record.
- interactive terminal — The -it flags that connect your keyboard to a container and give it a terminal, so you can use a shell inside it.
- terminal — The text window where you type commands and read their output.
- nohup — A command that runs another command immune to the hangup signal, so it keeps running after you log out.
- log — A time-stamped record of an individual event in a system, such as one request being handled; structured logs record it as named fields rather than free text.
- output capturing — pytest's default behaviour of holding back anything a test prints and showing it only if the test fails.
Taught in
- What MCP Is — AI Engineering: LLM Apps, RAG & Agents
- Build An MCP Server — AI Engineering: LLM Apps, RAG & Agents
- Connect An Agent To MCP — AI Engineering: LLM Apps, RAG & Agents
- Connections And Privilege Escalation — Ansible Configuration Management at Scale
- Standard Input, Output And Error — Bash Scripting & Command Line Automation
- Redirection: Truncate, Append, Both Streams — Bash Scripting & Command Line Automation
- Pipelines, tee And Process Substitution — Bash Scripting & Command Line Automation
- Reshaping Text: cut, sort, uniq, tr, sed, awk — Bash Scripting & Command Line Automation
- Command Substitution And Subshells — Bash Scripting & Command Line Automation
- Exit Codes, And What Success Means — Bash Scripting & Command Line Automation
- Script Input And Output: read, Heredocs, printf — Bash Scripting & Command Line Automation
- Functions, local And declare — Bash Scripting & Command Line Automation
- set -e, set -u And pipefail: Promises And Traps — Bash Scripting & Command Line Automation
- trap, Cleanup And Temporary Files — Bash Scripting & Command Line Automation
- find And xargs — Bash Scripting & Command Line Automation
- Archives, Transfers And The Network — Bash Scripting & Command Line Automation
- Scheduling, Monitoring And A Script That Reports — Bash Scripting & Command Line Automation
- Securing Pipelines: Secrets Management — Continuous Integration & Continuous Delivery Pipelines
- Container Logs — Certified Kubernetes Application Developer (CKAD) Exam Prep
- Pre-Commit Secret Scanning with Gitleaks & Entropy — Cloud Security & DevSecOps Engineering
- Runtime Anomaly Detection with Falco & eBPF — Cloud Security & DevSecOps Engineering
- Disposability, Dev Prod Parity And Logs — DevOps & Site Reliability Engineering
- Commands, Logs, Exec And Exit Codes — Docker Architecture & Production Containers
- Authenticate, Tag, Push And Pull From A Registry — Docker Architecture & Production Containers
- Integration Tests, Test Data And Compose Cleanup — Docker Architecture & Production Containers
- Structured Logging & Correlation IDs: Context Stitching — Production Full-Stack Engineering
- Why Version Control, And Why Git Won — Advanced Git Internals & Distributed Workflows
- What A Commit Really Is — Advanced Git Internals & Distributed Workflows
- Committing, And What A Good Message Says — Advanced Git Internals & Distributed Workflows
- Your First Program and go run — Concurrent Systems Programming with Go
- Errors as Values — Concurrent Systems Programming with Go
- Files and the os Package — Concurrent Systems Programming with Go
- Streams and the io Package — Concurrent Systems Programming with Go
- Parsing Arguments with flag — Concurrent Systems Programming with Go
- Shipping in Scratch and Distroless Images — Concurrent Systems Programming with Go
- Exporting Results as JSON — Concurrent Systems Programming with Go
- Release Trains And Long Term Support — Modern Java: Virtual Threads & High-Throughput Services
- Packaging Into A Container — Modern Java: Virtual Threads & High-Throughput Services
- Console And File I/O With Streams — Oracle Certified Professional: Java SE 21 Developer (1Z0-830) Exam Prep
- Serialization: What Survives The Trip — Oracle Certified Professional: Java SE 21 Developer (1Z0-830) Exam Prep
- Why A Log And Not A Queue — Apache Kafka & Event Streaming
- The Image Nobody Tested: Cloud Native Principles — Kubernetes and Cloud Native Associate (KCNA) Exam Prep
- Slow, Or Broken? Metrics, Logs And Traces — Kubernetes and Cloud Native Associate (KCNA) Exam Prep
- Architecture Sprint: The Refunds Review — Kubernetes and Cloud Native Associate (KCNA) Exam Prep
- What A Kernel Does, And What It Refuses To Do — Linux Fundamentals & Systems Administration
- Job Control, And Processes That Outlive You — Linux Fundamentals & Systems Administration
- Child Processes: spawn, execFile, fork & IPC — Node.js Internals & Backend Services
- Global Error Trapping: uncaughtException & Exits — Node.js Internals & Backend Services
- Structured Logging And Why Text Fails — Full-Stack Observability: Metrics, Tracing & Logging
- Fixtures And Their Scope — Automated Testing, TDD & Quality Engineering
- When awk Runs Out: Python Data Types, Modules And Virtual Environments For Admins — CompTIA Linux+ (XK0-006) Exam Prep
- Loops: One Task, Many Items — RHCE in Ansible (EX294): Automate Red Hat Systems
- Conditionals: register, when, changed_when And failed_when — RHCE in Ansible (EX294): Automate Red Hat Systems
- ansible-navigator: The Settings File The Exam Reads — RHCE in Ansible (EX294): Automate Red Hat Systems
- Finding Modules In Collections: ansible-doc And navigator — RHCE in Ansible (EX294): Automate Red Hat Systems
- Services And Boot Targets: Started Is Not Enabled — RHCE in Ansible (EX294): Automate Red Hat Systems
- File Systems And Mounts: mounted, present And UUIDs — RHCE in Ansible (EX294): Automate Red Hat Systems
- SELinux: Labels, Ports And Booleans That Persist — RHCE in Ansible (EX294): Automate Red Hat Systems
References
- man7: stdout(3)
- stdin(3) manual page
- Bash Reference Manual: Redirections
- The Twelve-Factor App: logs
- Python logging module
- Python docs: sys.stdout
Certification courses
- AWS AIP-C01 course and practice exam: AI engineering with LLM apps, RAG and agents
- CKAD course and practice exam: Certified Kubernetes Application Developer
- 1Z0-830 course and practice exam: Oracle Java SE 21 Developer Professional
- KCNA course and practice exam: Kubernetes and Cloud Native Associate
- CompTIA Linux+ course and practice exam: XK0-006
- RHCE course and practice exam: Red Hat Certified Engineer in Ansible (EX294)