Save last "copy" from clipboard to file

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!

1 Answer

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
2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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

You Might Also Like