Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am able to copy a massive string of text but unable to paste it anywhere without the program crashing.

So, I wonder: How can I fetch it from the clipboard via CLI and save it to a file instead?

Thanks!

share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

xclip is the command line interface to X selections (clipboard)

xclip -o > helloworld.c

You may need to modify the command depending on the selection you're using

   -selection
          specify  which  X  selection  to use, options are "primary" to use XA_PRIMARY (default), "secondary" for XA_SECONDARY or
          "clipboard" for XA_CLIPBOARD
share|improve this answer
    
+1 for xclip - so useful! –  Brandon Bertelsen Dec 10 '12 at 23:40
    
Thanks! I've used this before but I couldn't remember the command for the life of me! –  Nathan J. Brauer Dec 12 '12 at 21:56
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.