Terminal: Exporting Text from Commands

What these do is pretty simple but really helpful. Let’s say you’ve just run a command with a lot of output—fs_usage, for example, which I’ve written about before—and you decide that you want to save all the data that Terminal just gave you. If you think about it ahead of time, you can of course use the pipe command. I wrote about that in yet another article on Terminal a while back. (I’m sensing a pattern here on what I like to do tips about, you guys.)

But what do you do if you want to save what’s already in your Terminal window, without having to run commands again? That’s where Shell> Export Text As comes in. It’ll insert everything that’s been output in your current Terminal window to a text file that you can save anywhere.

One of the things that’s nifty about this is that it saves everything out since your Terminal window was opened, even if you quit the program in the meantime (as long as you’re running a recent version of the operating system that’ll let you resume where you left off in your applications, that is). If you’ve got System Preferences> General> Close windows when quitting an application toggled on, Terminal of course won’t reopen any windows you had from your previous sessions, so you’ll only be saving out what you’d done since the last time the program was opened. 

If what you’re looking to save out instead is not the entire contents of your Terminal window but only some of it, you can use Export Selected Text As. To try this, click and drag to select whatever portion of the Terminal output you intend to keep:

After you’ve got your text selected, pick Shell> Export Selected Text As from the menu at the top of your screen, and as before, you’ll be given an option to save it somewhere as a pretty little text file.

I find this handy quite often; sometimes it’s just easier to look through a ton of output in a text file rather than in Terminal. I mean, I love me some Terminal, but it ain’t always the most convenient way to perform tasks. Blasphemy, I know.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

WIN an iPhone 16 Pro Max!