Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I just want to create a file with the outputted text from a command, rather then copying and pasting & making a new file by hand.

I'm on a unix machine - how do I do this?

share|improve this question

Redirecting. At the end of any command, type > filename.txt. Replace filename.txt with the file name you want to use. You can even output to different devices (dangerous) or directories (ls > /home/user/ls.txt for example)

As @Josh pointed out as well:

If you need to see the output too you can use the tee command to output to stdout as well as a file. ls | tee file.txt

share|improve this answer
2  
If you need to see the output too you can use the tee command to output to stdout as well as a file. ls | tee file.txt – Josh Jan 4 '13 at 19:19
2  
Plus to append an existing file, use >>. – Xyon Jan 4 '13 at 21:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .