1XCLIP(1) General Commands Manual XCLIP(1)
2
3
4
6 xclip - command line interface to X selections (clipboard)
7
9 xclip [OPTION] [FILE]...
10
12 Reads from standard in, or from one or more files, and makes the data
13 available as an X selection for pasting into X applications. Prints
14 current X selection to standard out.
15
16 -i, -in
17 read text into X selection from standard input or files (de‐
18 fault)
19
20 -o, -out
21 print the selection to standard out (generally for piping to a
22 file or program)
23
24 -f, -filter
25 when xclip is invoked in the in mode with output level set to
26 silent (the defaults), the filter option will cause xclip to
27 print the text piped to standard in back to standard out unmodi‐
28 fied
29
30 -r, -rmlastnl
31 when the last character of the selection is a newline character,
32 remove it. Newline characters that are not the last character in
33 the selection are not affected. If the selection does not end
34 with a newline character, this option has no effect. This option
35 is useful for copying one-line output of programs like pwd to
36 the clipboard to paste it again into the command prompt without
37 executing the line immediately due to the newline character pwd
38 appends.
39
40 -l n, -loops n
41 number of X selection requests (pastes into X applications) to
42 wait for before exiting, with a value of 0 (default) causing
43 xclip to wait for an unlimited number of requests until another
44 application (possibly another invocation of xclip) takes owner‐
45 ship of the selection.
46
47 -t t, -target t
48 specify a particular data format using the given target atom.
49 With -o the special target atom name "TARGETS" can be used to
50 get a list of valid target atoms for this selection. The default
51 target is "STRING". For more information about target atoms re‐
52 fer to ICCCM section 2.6.2
53
54 -d, -display
55 X display to use (e.g. "localhost:0"), xclip defaults to the
56 value in $DISPLAY if this option is omitted
57
58 -h, -help
59 show quick summary of options
60
61 -selection
62 specify which X selection to use, options are "primary" to use
63 XA_PRIMARY (default), "secondary" for XA_SECONDARY or "clip‐
64 board" for XA_CLIPBOARD
65
66 -version
67 show version information
68
69 -silent
70 fork into the background to wait for requests, no informational
71 output, errors only (default)
72
73 -quiet show informational messages on the terminal and run in the fore‐
74 ground
75
76 -verbose
77 provide a running commentary of what xclip is doing
78
79 -noutf8
80 operate in legacy (i.e. non UTF-8) mode for backwards compati‐
81 bility (Use this option only when really necessary, as the old
82 behavior was broken)
83
84 -sensitive
85 clear sensitive data from seleciton buffer after being pasted
86 once. This is currently implemented as -wait 50. See NOTES
87
88 -wait n
89 after the first paste, wait for n milliseconds. If a subsequent
90 paste request arrives before the timer expires, reset the timer.
91 Once the timer expires, the selection buffer is cleared so the
92 data cannot be pasted again.
93
94
95 xclip reads text from standard in or files and makes it available to
96 other X applications for pasting as an X selection (traditionally with
97 the middle mouse button). It reads from all files specified, or from
98 standard in if no files are specified. xclip can also print the con‐
99 tents of a selection to standard out with the -o option.
100
101 xclip was designed to allow tighter integration of X applications and
102 command line programs. The default action is to silently wait in the
103 background for X selection requests (pastes) until another X applica‐
104 tion places data in the clipboard, at which point xclip exits silently.
105 You can use the -verbose option to see if and when xclip actually re‐
106 ceives selection requests from other X applications.
107
108 Options can be abbreviated as long as they remain unambiguous. For ex‐
109 ample, it is possible to use -d or -disp instead of -display. However,
110 -v couldn't be used because it is ambiguous (it could be short for
111 -verbose or -version), so it would be interpreted as a filename.
112
113 Note that only the first character of the selection specified with the
114 -selection option is important. This means that "p", "sec" and "clip"
115 would have the same effect as using "primary", "secondary" or "clip‐
116 board" respectively.
117
118
120 I hate man pages without examples!
121
122 uptime | xclip
123
124 Put your uptime in the X selection. Then middle click in an X applica‐
125 tion to paste.
126
127 xclip -o > helloworld.c
128
129 Put the contents of the selection into a file.
130
131 xclip -t text/html index.html
132
133 Middle click in an X application supporting HTML to paste the contents
134 of the given file as HTML.
135
136 xclip -loops 10 -verbose /etc/motd
137
138 Exit after /etc/motd (message of the day) has been pasted 10 times.
139 Show how many selection requests (pastes) have been processed.
140
141
143 Using the -sensitive option will clear the selection buffer of the sen‐
144 sitive information 50 milliseconds after it has been pasted, effec‐
145 tively only allowing the selection to be pasted once. In some instances
146 this may be too low and will prevent pasting. If this is the case, or
147 if the user needs to be able to paste more than once for some other
148 reason, they may use -wait n instead. -wait is the same as -sensitive,
149 except it allows one to adjust the time to wait before clearing the se‐
150 lection to be n milliseconds.
151
152 Ideally, -sensitive would allow exactly one paste and not need a time‐
153 out, but due to subtleties in the way the X clipboard protocol works,
154 doing so is not as simple as it may seem.
155
156
158 DISPLAY
159 X display to use if none is specified with the -display option.
160
161
163 Please report any bugs, problems, queries, experiences, etc. directly
164 to the author.
165
166
168 Kim Saunders <kims@debian.org> Peter Åstrand <astrand@lysator.liu.se>
169
170
171
172 XCLIP(1)