Monday, May 6, 2024
7
rated 0 times [  7] [ 0]  / answers: 1 / hits: 15737  / 2 Years ago, sat, june 4, 2022, 9:36:39

Basically, what I would like to do is, instead of just redirecting the out from my terminal command to a file, I would like to have the information also show in the terminal session.



If I use ~$ command > output.log I am no longer able to see the command process in the terminal window and therefore I do not know when the command has finished processing without looking at the output.log file. The commands I run take a few minutes to process and produce quite a bit of output. (hence me wanting to capture that output) Any suggestions?


More From » command-line

 Answers
6

The answer to your question is tee. Just use | tee [output file] instead of > [output file]



Thus, sudo apt-get update > out.log
becomes
sudo apt-get update | tee out.log.



For more information: LinuxQuestion.org: BASH: How to Redirect Output to File, AND Still Have it on Screen, Linux by Examples: How to redirect output to a file as well as display it out.


[#38194] Monday, June 6, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
edseager

Total Points: 185
Total Questions: 105
Total Answers: 102

Location: Angola
Member since Wed, Apr 13, 2022
2 Years ago
;