A terminal transcript is useful when a reader can copy the command and compare what happens. Split the shell command and its output into separate Markdown blocks.

Name the input and show only the command

For this example, inventory.txt contains three entries, each followed by a newline. Run the command from the folder containing it:

wc -l < inventory.txt

A sample inventory file has three newline-terminated entries and the command counts its lines.

Illustrated setup. State which file the command reads.

Label the output as output

For the sample file, the line count is:

3

Use a separate fenced block in the Markdown source and keep any terminal prompt outside the copyable command. Some implementations of wc add leading spaces, so compare the count.

The output block contains only the observed count of 3, separate from the shell command.

Illustrated copy test. A reader can copy the command without picking up the output.

Copy the rendered command into a clean shell using the same sample input. Compare the observed result with the documented block before sharing.

CommonMark’s fenced code block reference.