Last updated on June 29, 2020 by Dan Nanni
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 use xclip
, which is a command line interface to clipboard. The xclip
command can read text directly from standard input, and copy it to clipboard.
xclip
on LinuxTo install xclip
on Ubuntu, Debian or Linux Mint:
$ sudo apt-get install xclip
To install xclip
on Fedora:
$ sudo yum install xclip
To install xclip
on CentOS/RHEL, first enable Repoforge repository, and then run:
$ sudo yum install xclip
xclip
To copy the content of a file to clipboard, simply run the following command.
$ 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.
This website is made possible by minimal ads and your gracious donation via PayPal or credit card
Please note that this article is published by Xmodulo.com under a Creative Commons Attribution-ShareAlike 3.0 Unported License. If you would like to use the whole or any part of this article, you need to cite this web page at Xmodulo.com as the original source.
Xmodulo © 2021 ‒ About ‒ Write for Us ‒ Feed ‒ Powered by DigitalOcean