It is simple question but couldn't find the answer, I found and tried tee output.txt
and system_profiler > output.txt
but no success, they save blank text file. How do I save my terminal output with command in terminal on OSX El Capitan?
Macos – Save Terminal Output command on OSX
command linemacmacososx-el-capitanterminal
Best Answer
Assuming
command
is the command you want to run, you can pipe it's output into the output.txt using:or
If this doesn't hell it may be because the output is not printed on
stdout
but onstderr
. The pipe>
is implicit writing for1>
which means "pipestdout
to ...".If you want to pipe
stderr
into the file too, you can useThis pipes all the output of
stderr
to the file-descriptor1
(=stdout
) which in turn is piped into the text file.