xclip is a command line interface to the X11 clipboard. It can also be used for copying files, as an alternative to sftp/scp, thus avoiding password prompts when X11 forwarding has already been setup.
Questions tagged [xclip]
53 questions
133
votes
17 answers
Getting tmux to copy a buffer to the clipboard
I am trying to figure out a decent way to copy what I have in a tmux buffer into my clipboard. I have tried a couple of different things like
bind-key p select-pane -t 2 \; split-window 'xsel -i -b' \; paste-buffer
which gets me fairly close, all…
Digital Powers
- 1,817
- 4
- 14
- 11
95
votes
9 answers
Use system clipboard in vi-copy mode in tmux
I'm running tmux 1.6 and I'm trying to configure it to use vi-style keybindings as well as use the system clipboard when copying in interactive mode:
set-window-option -g mode-keys vi
bind-key -t vi-copy 'v' begin-selection
bind-key -t vi-copy 'y'…
Naftuli Kay
- 38,686
- 85
- 220
- 311
17
votes
2 answers
Copy markdown input to the clipboard as rich text
I'm about to get involved in some collaborative prose writing with a friend of mine via email. As a regular person, he will of course be using MS Word document formats; as a massive nerd, I prefer to use markdown when writing on a computer.
What I…
evilsoup
- 6,727
- 3
- 33
- 40
15
votes
2 answers
How to target multiple selections with xclip
When copying text to the clipboard, xclip provides several selection targets:
-selection
specify which X selection to use, options are:
"primary" to use XA_PRIMARY (default),
"secondary" for XA_SECONDARY
"clipboard" for…
Amelio Vazquez-Reina
- 40,169
- 77
- 197
- 294
11
votes
2 answers
How to copy text from command line to clipboard without using the mouse?
I'm trying to figure out a way to copy the current text in a command line to the clipboard WITHOUT touching the mouse. In other words, I need to select the text with the keyboard only.
I found a half-way solution that may lead to the full…
Sancho Pancho
- 123
- 1
- 6
11
votes
1 answer
Is it possible to know the source (application) of the clipboard?
I've noticed that sometimes clipboard contents become unavailable if the source application (where the content was copied from) is closed.
This leads me to wonder if it's possible to know what the source application is (e.g. perhaps by PID).
Why? If…
Jeff Ward
- 623
- 5
- 9
11
votes
1 answer
xclip does not change the clipboard content
I'm trying to give the following command:
echo "hi" | xclip -selection c
This doesn't work? It has worked in the past, but never consistently. I also tried
echo "hi" | xclip -selection primary
echo "hi" | xclip -selection…
Alex
- 323
- 3
- 8
10
votes
2 answers
xclip image binary contents pasted into text fields
Say I pick some png file and run the following command:
xclip -selection clip -t image/png image.png
I now have that image in my clipboard. If I paste it somewhere that accepts an image, it is pasted as expected and all is good.
Now instead…
Alice Ryhl
- 581
- 6
- 19
9
votes
6 answers
tmux xclip copy no longer working
On mu Ubuntu 12.04 setups my tmux clipboard copy and paste commands are setup as follows:
set -g prefix M-a
unbind C-b
bind C-c run "tmux save-buffer - | xclip -i -sel clipboard"
bind C-v run "tmux set-buffer \"$(xclip -o -sel clipboard)\"; tmux…
Alexandr Kurilin
- 2,481
- 2
- 16
- 13
9
votes
2 answers
xsel and xclip hang
My objective is to make a text on my remote machine (CentOS 7.2) available to seamlessly paste on my local machine (OS X 10.12.2) with the standard ⌘V shortcut. My setup connects to the remote machine with ssh -Y and then attaches to tmux (or…
Kvass
- 221
- 1
- 5
7
votes
2 answers
How can I paste a gif from the clipboard with xclip?
I'm trying to copy a gif into my clipboard such that I would be able to paste it into web applications (slack, github, etc.).
I have tried the following without any luck:
xclip -selection clipboard -t image/gif < /path/to/image.gif
charlespwd
- 171
- 2
6
votes
2 answers
Why does xclip-copied text pasted into Gmail on Firefox turn line breaks into spaces?
I have a text editor I made that uses xclip to copy text. I notice that when I paste the xclip-copied text (pasting the regular way, with ctrl+v) into a Gmail email on Firefox 54.0 (64-bit) that I'm composing, it replaces all of the line breaks with…
Brōtsyorfuzthrāx
- 297
- 3
- 12
5
votes
0 answers
xclip Outputs "Error: Can't open display: (null)"
I recently installed xclip on my CentOS 7 server. Since my machine does not have an X server, I'd have to configure my machine to forward X11 to my client.
Following the steps explained in this answer here:
on my client(macOS 10.13), I wrote…
Can Sürmeli
- 249
- 1
- 3
- 12
5
votes
4 answers
xclip works differently in interactive and non-interactive shells
While investigating a problem described in a question at stackoverflow I simplified it down to a test case demonstrating that in non-interactive mode bash seems to clear the X system clipboard before exiting. The test opens a gnome terminal and runs…
Leon
- 191
- 1
- 8
5
votes
2 answers
Abbreviated long options on the command line of xclip
In the manpage of xclip
-selection
specify which X selection to use, options are
"primary" to use XA_PRIMARY (default),
"secondary" for XA_SECONDARY or
"clipboard" for XA_CLIPBOARD
Note that only the first character of the selection specified…
Tim
- 98,580
- 191
- 570
- 977