LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Redirecting to file and stdout (https://www.linuxquestions.org/questions/programming-9/redirecting-to-file-and-stdout-383077/)

Quantum0726 11-14-2005 12:45 PM

Redirecting to file and stdout
 
Hi, I would like to find a way to be able to redirect output to a file, but still have it display on the screen, i.e. just copy it to a file as the command is running. Now I have been using the standard &> operator to redirect it all to a file, using the command in a screen. Then I run tail -f on the file and I can see the output as it's written. Is there a way to do this using redirection operators? Or just a better way than I am doing it?

Thanks much!

Berhanie 11-14-2005 12:50 PM

Code:

man tee

Dark_Helmet 11-14-2005 12:52 PM

You're looking for the tee command. As in:
Code:

$ ls -l | tee directory_listing.txt
Tee displays what it receives as standard input to the screen and also writes it verbatim to the specified file.

Quantum0726 11-14-2005 08:35 PM

tee works perfectly. Thanks!


All times are GMT -5. The time now is 08:27 AM.