Question: I have a relatively big text file. I would like to copy the whole file content, and paste it to somewhere else on my Linux desktop. Is it possible to copy the content of a file to clipboard without opening the file?
In X windows system, clipboard is a mechanism for transferring data from one window to another, or sharing data among different applications. Typically you use a mouse to select a text and copy it to clipboard.
However, if you want to copy the whole file content to clipboard without opening it, you can usexclip, which is a command line interface to clipboard. The xclip command can read text directly from standard input, and copy it to clipboard.
Install xclip on pcDuino Ubuntu
To install xclip on pcDuino Ubuntu:
$ sudo apt-get install xclip
Copy File Content to Clipboard using Xclip
To copy the content of a file to clipboard, simply run the following command.
$ echo "sudo apt-get upate" >> input.txt $ cat input.txt | xclip -i
Once the file content is copied to clipboard, you can paste it into another window or application simply by clicking on mouse middle-button.
Leave a Reply
You must be logged in to post a comment.