Skip to content

Instantly share code, notes, and snippets.

@fanurs
Last active April 11, 2022 17:18
Show Gist options
  • Save fanurs/3ae4eddaacb9d841337a4e1aad82f7ad to your computer and use it in GitHub Desktop.
Save fanurs/3ae4eddaacb9d841337a4e1aad82f7ad to your computer and use it in GitHub Desktop.
How to save terminal output to a file on Linux?
Please note that the n.e. in the syntax column means "not existing".
There is a way, but it's too complicated to fit into the column. You can find a helpful link in the List section about it.
|| visible in terminal || visible in file || existing
Syntax || StdOut | StdErr || StdOut | StdErr || file
==========++==========+==========++==========+==========++===========
> || no | yes || yes | no || overwrite
>> || no | yes || yes | no || append
|| | || | ||
2> || yes | no || no | yes || overwrite
2>> || yes | no || no | yes || append
|| | || | ||
&> || no | no || yes | yes || overwrite
&>> || no | no || yes | yes || append
|| | || | ||
| tee || yes | yes || yes | no || overwrite
| tee -a || yes | yes || yes | no || append
|| | || | ||
n.e. (*) || yes | yes || no | yes || overwrite
n.e. (*) || yes | yes || no | yes || append
|| | || | ||
|& tee || yes | yes || yes | yes || overwrite
|& tee -a || yes | yes || yes | yes || append
Credit: Byte Commander
Reference: https://askubuntu.com/a/731237
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment