LOGBOOK

HELP

1 / 33
Other keys: showSpace: good1-4: rate0: skip5: flag6: invert

Question

What are input and output in Linux and how are they visualized in the terminal?

Answer

Input is what a program reads (usually keystrokes), output is what it writes back (usually to the screen) — by default both flow through the terminal.

Every interactive program sits between two streams: it reads input and writes output. In a terminal, the keyboard is the default source of input and the screen is the default destination for output, which is why typing and seeing results feels seamless.

read -p "What's your name? " name   # reads a line of input into $name
echo "Good day, $name"              # writes output back to the screen

Run it and you get:

What's your name? Florian
Good day, Florian

Why this matters: because input and output are just streams, not hard-wired to the keyboard and screen, you can later redirect them — feed a file in as input, or capture output into a file or another command. That decoupling is the whole foundation of redirection and pipes.

Tip: read -p prints the prompt and reads in one step; without -p you'd echo the prompt yourself.

or press any other key