1
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?
1
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?
6
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
teecommand to output to stdout as well as a file.ls | tee file.txt
2If 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 – 2013-01-04T19:19:59.073
2Plus to append an existing file, use >>. – Xyon – 2013-01-04T21:06:17.737