Command line interface to the X11 clipboard
C Shell Other Makefile M4
Latest commit 9e13102 Sep 21, 2016 @astrand committed on GitHub Merge pull request #29 from czarkoff/tar
Add "-f -" flags to tar
Failed to load latest commit information.
.gitignore Add .gitignore Mar 9, 2016
COPYING Imported xclip 0.03 Jun 13, 2007
ChangeLog Bump up version to 0.13, add git log to ChangeLog Sep 13, 2016
INSTALL Fix building steps in INSTALL Mar 9, 2016 Install and ship xclip-copyfile.1 Aug 10, 2009
README Changing Sourceforge URLs to GitHub. Feb 2, 2016
bootstrap Switched to Autoconf, instead of Imake Aug 25, 2007 Bump up version to 0.13, add git log to ChangeLog Sep 13, 2016
indent-all Added indent script Jul 8, 2007
install-sh Switched to Autoconf, instead of Imake Aug 25, 2007
xcdef.h Replaced XC_VERS and XC_NAME with PACKAGE_NAME and PACKAGE_VERSION Aug 15, 2008
xclib.c Applied patch from Marcin Szewczyk <>: Feb 9, 2014
xclib.h Applied 2924602 - 0004-Improved-xclip-s-error-handling.patch Apr 30, 2010
xclip-copyfile It seems like newer tar complains when appending to non-existing file… Jul 12, 2008
xclip-copyfile.1 Added manpage for xclip-{copy,cut,paste}file. Contributed by Maximili… Aug 10, 2009
xclip-cutfile Added xclip-cutfile, which removes files after xclip invocation Sep 2, 2007
xclip-pastefile Add "-f -" flags to tar Sep 13, 2016
xclip.1 Add the remove-last-newline option Mar 10, 2016
xclip.c Merge pull request #23 from hwangcc23/remove_last_newline Mar 14, 2016
xclip.spec Bump up version to 0.13, add git log to ChangeLog Sep 13, 2016
xcprint.c Add the remove-last-newline option Mar 10, 2016
xcprint.h Removed executable prop Aug 12, 2007
xctest Use mktemp rather than tempfile Aug 26, 2007



xclip is a command line utility that is designed to run on any system with an
X11 implementation. It provides an interface to X selections ("the clipboard")
from the command line. It can read data from standard in or a file and place it
in an X selection for pasting into other X applications. xclip can also print
an X selection to standard out, which can then be redirected to a file or
another program.


Here are some ideas for things you can do with xclip:

	Copy your uptime into the selection for pasting:
	uptime | xclip

	Copy your password file for pasting:
	xclip /etc/passwd

	Save some text you have Edit | Copied in a web browser:
	xclip -o -sel clip > webpage.txt

	Open a URL selected in an email client
	mozilla `xclip -o`

	xclip -o | xclip -sel clip

	In command mode in vim, select some lines of text, then press shift-:
	for an ex prompt, and use this command to copy the selected lines of
	text to the primary X selection:
	!xclip -f


The programs xclip-copyfile, xclip-pastefile, and xclip-cutfile can be
used for copying and moving files between different directories and
even machines, assuming that you have a working X11 connection. Here
are some examples:

# Copying a file to a remote host
[ ~]$ echo "A file created on ${HOSTNAME}" > file1
[ ~]$ xclip-copyfile file1
[ ~/doc]$ xclip-pastefile
[ ~/doc]$ cat file1
A file created on

# Copying an entire tree structure
[ ~]$ xclip-copyfile doc
[ ~/tmp]$ xclip-pastefile

# Copying files with preserved path information
[ ~]$ xclip-copyfile -p /etc/sysconfig/grub
tar: Removing leading `/' from member names
[ ~/tmp]$ xclip-pastefile
[ ~/tmp]$ ls etc/sysconfig/grub

# Moving files
[ ~]$ ls letter-brother-may.txt
[ ~]$ xclip-cutfile letter-brother-may.txt
[ ~]$ ls letter-brother-may.txt
ls: cannot access letter-brother-may.txt: No such file or directory
[ ~]$ cd doc
[ ~/doc]$ xclip-pastefile


* Reads data piped to standard in or files given as arguments
* Prints contents of selection to standard out
* Accesses the XA_PRIMARY, XA_SECONDARY or XA_CLIPBOARD selection
* Accesses the cut-buffers
* Supports the INCR mechanism for large transfers
* Connects to the X display in $DISPLAY, or specified with -display host:0 
* Waits for selection requests in the background


For a good overview of what selections are about, have a look at 
<>. Short version:

* XA_PRIMARY contains the last text you highlighted
* Middle click pastes XA_PRIMARY
* XA_CLIPBOARD contains text explicitly copied with Edit | Copy, Ctrl-C etc.
* Edit | Paste pastes XA_CLIPBOARD
* xclip uses XA_PRIMARY unless you specify otherwise with -selection 


Glad you asked! At this stage, I'm pretty happy with the features and
implementation, so if you have anything at all that should be done, I want to
hear about it. Doesn't matter how small, compiler warnings, segfaults, spelling
mistakes, whatever, I want to get it sorted out. xclip is not a big project,
I'd like to get all these things sorted out and then declare it "complete".


GNU GPL, see the COPYING file for details.




Please email me about problems, experiences, patches, fixes, etc.