Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How can I take the output of a shell script and place it in a file on the command line?

share|improve this question

migrated from stackoverflow.com Oct 29 '09 at 14:37

This question came from our site for professional and enthusiast programmers.

add comment

2 Answers

# write to file
sh myscript > out.txt
# append to file
sh myscript >> out.txt
# write both output and stderr to file
sh myscript 2&1>> out.txt
share|improve this answer
add comment
$ ./foo >> myoutputfile.txt
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.