Skip to content

Save terminal output to a file (stdout, stderr, tee) — by Seth on Ask Ubuntu

beginnerforumCC BY-SA (Stack Exchange; version depends on post date)

A clear reference to shell redirection: > overwrites a file, >> appends, 2> captures errors, and tee shows output on screen while also writing it to a file.

Quick steps

  1. Overwrite: command > file.txt
  2. Append: command >> file.txt
  3. Show and save: command | tee file.txt

Paraphrased from the source. Menus can differ by version, so check the original for full details.

Read the full thread on askubuntu.com

Source: Save terminal output to a file (stdout, stderr, tee) by Seth on Ask Ubuntu. Licence: CC BY-SA (Stack Exchange; version depends on post date).

Source reviewed
2026-11-02
Link checked
Not yet
Tested hands-on
Not by Oddbyte.Me

redirectionstdoutstderrteebash

More in Community Answers (Stack Exchange)