12

I've just run some commands and have several pages of output in iTerm2. Now I'd like to save it somewhere. (I could have piped it to a file, but I didn't think of that.)

Is there an easier way to copy it all to the clipboard that by scrolling back and highlighting for pages?

7

Oh, right, duh. + A to select it all, then + C.

  • 1
    There is a setting in iTerm 2 that automatically copies anything selected to the clipboard, making the Command-C unnecessary. – Ɱark Ƭ Jul 17 '14 at 17:34
  • I did this, but saving a 100M scrollback log through clipboard took iTerm2 about 5 min, and a bit less - to paste it into a text editor. I wish Cmd-S saved the buffer directly. – Victor Sergienko Jan 5 '17 at 0:55
  • 5
    pbpaste > ~/Desktop/buffer.log took milliseconds for 17meg file – Drew Mar 7 '17 at 14:04
3

You probably know this, but if anyone comes in the future, this works too:

history > ~/Desktop/history.txt

Or some other file of your choice. The file will be overwritten, or you can use >> to append.

If you want output as well, the shell command script works as well to capture while you type (but it captures key presses too, so watch out) or iTerm will have some option to save a session, like the stock Terminal's + S.

  • 3
    this will only save your commands, and not their output – Ciprian Tomoiagă Jul 1 at 17:18

You must log in to answer this question.

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