Capture command line output directly to a text file

Jul 29, '08 07:30:04AM

Contributed by: merlyn

If you're running a Unix command (inside Terminal or otherwise), and you want to quickly capture the standard output in an editable buffer (for examination or snipping), just add | open -tf after the command.

The output of the command will be placed into a new TextEdit buffer, stored in the /private/tmp folder. For example, to get the output of the command-line version of System Profiler into a text file, just type (in the Terminal window):

system_profiler | open -tf
You can then edit the document, and save it (use File » Save As to pick a save location). This method saves a step over using a redirect (>) and then opening the resulting file.

Comments (19)


Mac OS X Hints
http://hints.macworld.com/article.php?story=2008072518010713