Catat output terminal
# The table below show the common syntax for logging terminal in ubuntu
#The numerals 0 through 9 are file descriptors in bash.
#0 stands for standard input, 1 stands for standard output,
#2 stands for standard error. The syntax follows the following examples:
mycommand |& tee output.txt
#The above, logs in both standard output and standard error to output.txt.
mycommand 2>stderr.log 1>stdout.log
#The above logs the standard error and standard output to different files.
|| 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
Coderunner