I have a slight problem at the moment, I have a large amount of output in a Terminal (gnome-terminal) at the moment, so large in fact that the clipboard won't take it... So I wondering if there is any way for me to get a script to run through all the current output there or something and then put it into a file, line by line if it has to? I am running Ubuntu GNOME 15.10 with GNOME 3.18.

Clarification: As this seems to be confusing a few, I do not want to be told how to pipe the output or similar to a file before it's outputted it into Terminal, I currently have over 100k lines in my Terminal and I wish to move them into a file but the clipboard won't take them and rerunning the command which outputted them and then piping into a file isn't really an option at the moment...

  • 1
    @RPiAwesomeness: No, this is not a duplicate of that because I do not want to know how to do it before hand, I want to know how to do it after I've got the output in Terminal...
    – user364819
    Mar 19 '16 at 17:32
  • Ah, I see. You might want to include that in the title to make it more clear. Perhaps something like "How to copy all current output in Terminal to file when too large for clipboard after output is stopped" or something similar? Mar 19 '16 at 17:35
  • @RPiAwesomeness: Ok, I have done so.
    – user364819
    Mar 19 '16 at 17:40
  • 1
    Apply the {Select, Copy, Paste} thing to subsets of the output. First line through Nth line, N+1th line to 2Nth line, lather, rinse, repeat.
    – waltinator
    Mar 19 '16 at 18:16

Pasting large data into terminals is often troublesome (I don't quite know why), so I recommend to perform Edit -> Select All, followed by Edit -> Copy in gnome-terminal, and then Paste into some non-terminal application such as gedit.

I tried with 600k lines. It took a couple of seconds to Select All and Copy in gnome-terminal, followed by a minute or so to Paste it into gedit, but luckily it worked flawlessly (on Ubuntu 16.04 beta; 15.10 is unlikely to behave differently).

But if nothing gets copied to the clipboard then you just need to copy in smaller chunks as the limit will have been reached.

  • Well, for me copying the data to the clipboard failed because only part of the data got there. I know this because when I then pasted it into gedit only a small part of it was there.
    – user364819
    Mar 19 '16 at 21:37
  • From your description, you can't be sure whether the copy or the paste phase failed. I'm sorry that I can't give you any more help; all I know is that it worked for me.
    – egmont
    Mar 20 '16 at 7:31
  • Look, the title says "How to copy all current output in Terminal to a file when too large for clipboard after it has already been outputted?", how does that not cover it?
    – user364819
    Mar 20 '16 at 10:33
  • And it is also clearly said in my clarification section.
    – user364819
    Mar 20 '16 at 10:34
  • Could you please clarify what does it mean that "the clipboard won't take" the contents? Do you get an error message or something like that? Can you examine the contents of the clipboard without pasting it? If so, how? Or do you paste it somewhere and notice that after the paste you get corrupted data? If so, how can you be sure that it's the copy and not the paste phase that corrupts it?
    – egmont
    Mar 20 '16 at 14:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy