• Home
  • pcDuino
  • WiKi
  • Store
  • Distributors
  • Home
  • pcDuino
  • WiKi
  • Store
  • Distributors
HomepcDuinoLinux ApplicationsHow to copy file content to clipboard from the com ...
Previous Next

How to copy file content to clipboard from the command line on pcDuino desktop

Posted by: Yang , July 16, 2014

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.

 

Tags: Linux Applications

Share!
Tweet

Yang

About the author

Leave a Reply Cancel reply

You must be logged in to post a comment.

Category

  • Home
  • pcDuino
  • WiKi
  • Store
  • Distributors