Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [xclip]

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.

1
vote
1answer
22 views

How to get clipboard as input file name to Vim on bash?

I install xclip to access system clipboard, my setting and some operations as below: ➜ ~ cat .zshrc | grep xclip alias c="xclip -selection c" alias v="xclip -selection c -o" ➜ ~ which dict | c ➜ ~ ...
1
vote
0answers
18 views

xclip copy file so it can be pasted as a file (not file content) [duplicate]

How can I copy a file with xclip, so that it is pastable as a file in file explorers? I searched on google an so on and found stuff like this Copy file to xclip and paste to Firefox, but there it is ...
1
vote
0answers
73 views

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 -...
0
votes
2answers
59 views

xclip doesn’t send contents to netcat

I got an assignment from my teacher to try and beat a bot which sends a number each time and I need to send the exact number, but faster. I wrote a bash script: #!/bin/bash while true; do nc ip ...
0
votes
0answers
50 views

Global filter on clipboard?

I'd like to make kind of filter for clipboard to remove newline characters at the end from anything I copy-paste on a daily basis. I know I could set a daemon listening through xclip for changes and ...
1
vote
0answers
86 views

Piping to another program in the middle of a oneliner

I'm trying to create a simple bash one line script that allows me to pick a particular barcode that's visible on my screen and make it available as text on my clipboard. To that effect, I wrote a bash ...
0
votes
2answers
96 views

How to chain external commands in VIM?

If I select the following text in a VIM buffer in VISUAL mode f() { echo "f"; } f and then execute :'<,'>w !xclip | !eval "$(xclip -o)" I get /bin/bash: eval: line 3: syntax error ...
1
vote
0answers
3k views

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 ...
0
votes
1answer
176 views

Tmux run-shell xclip not working

I am using tmux 2.3 and want to define a command to send the paste-buffer to system clipboard. I have tried using the command below and every variant I can think of, but when I try to run it, I get a ...
5
votes
1answer
182 views

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 ...
2
votes
1answer
482 views

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 ...
0
votes
1answer
2k views

Copy file to clipboard from console

I'm trying to copy the actual file content, including the file header and binary contents of a file to the clipboard. The file is a .pdf in this case. I've come across multiple solutions, but they ...
9
votes
1answer
3k views

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-...
6
votes
0answers
493 views

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 ...
1
vote
1answer
1k views

TMUX 2.3 copy to clipboard

I am using TMUX 2.3 just recently copying stopped working. Here is the relevant section that lets me copy stuff to the clipboard: bind-key -t vi-copy 'v' begin-selection bind-key -t vi-copy y copy-...
5
votes
2answers
1k views

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 ...
1
vote
0answers
45 views

Using xclip as workaround for missing key on keyboard?

My q key is gone from my keyboard. I'm trying to assign ctrl-a as a way to enter my q's, so from the bash prompt echo "q" |xclip; xclip -o outputs a q.. but saving that to a script then ...
0
votes
0answers
314 views

Is the default selection of xclip the primary one?

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 Since the ...
-2
votes
1answer
663 views

Do xsel and xclip work only for copy and not for paste?

The usages of xsel and xclip seem to me all about the copy operation, whether it is primary or clipboard selection. When I perform the paste operation, is it only by using mouse or trackpad, not via ...
4
votes
1answer
114 views

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 ...
10
votes
1answer
359 views

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 ...
2
votes
1answer
225 views

Is there a way to replace the currently selected text on X11?

I stumbled across xclip which gives you access to the text you have selected on your active window. I've been thinking if there was a way to alter such text. The workflow I have in mind is the ...
43
votes
6answers
38k views

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-...
3
votes
1answer
2k views

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 ...
7
votes
1answer
1k views

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 ...
8
votes
6answers
5k views

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 ...
9
votes
2answers
2k views

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"...
114
votes
16answers
93k views

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'...