I would like to copy the contents of a file to the X11 CLIPBOARD
target text/html
using the command line.
Ideally, this would be as portable as possible across different flavors of Linux and possibly other Unices.
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.
Sign up to join this communityI don't know the legacy UNIX flavors but under redhat and debian compatible linux distros, there exist a binary called xclip
, which does exactly what you want.
If you don't have it on your system, you can install it
Redhat variants
yum install xclip
Debian based
apt-get install xclip
xclip
versions built from SVN support setting the target. The versions shipped by default in Arch and Debian, at least, are not bleeding edge enough.
Jan 6, 2016 at 22:19
xclip -t $target
.
Jan 6, 2016 at 23:40