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.

Filter by
Sorted by
Tagged with
1 vote
1 answer
61 views

Disable automatically copying selection to clipboard in urxvt

There are 2 kind of clipboards on my os (manjaro i3). Xclip, which keeps the last selected text, and the regular clipboard which must be explicitly copied. I have noticed urxvt copies selected text in ...
0 votes
1 answer
57 views

How to create a keyboard shortcut for playing youtube videos with mpv?

I'm using Pop OS. I've aliased the command mpv $(xclip -o) & exit to pp so I can play youtube links copied to my clipboard with mpv player in lesser keystrokes in the terminal. I realised I may ...
  • 1
0 votes
2 answers
171 views

No new line when piping into xclip

Is there something I can do so that whenever I pipe something into xclip it does not include a new line at the end? As a workaround, I am using echo -n $(CMD_TO_COPY) | xclip, but it's kind of ...
0 votes
0 answers
23 views

tmux paste does not allow letters 't', 'm', 'u', 'x'

I have been messing with tmux config to get copy paste working, and I have it aproximately correct. I can copy things in tmux appropriately, but when I paste things in tmux will cut out any of the ...
  • 1
1 vote
0 answers
195 views

how to pipe Wayland clipboard into an X vnc session clipboard over ssh

I am using Wayland on Arch, and am sshed into a debian server which uses X11. I have a vnc session running over that ssh connection. I would like to take a string that I have stored in my Wayland ...
2 votes
0 answers
204 views

How to paste selection from vi-mode to clipboard

I want to access the content of what I copied in the buffer with the vi-mode of the clipboard via the command ctrl + v or ctrl + shift + v in the terminal. I copied in my .zshrc the following: (from ...
  • 359
1 vote
0 answers
82 views

How can read the content of the active window?

I am trying to create a bash script that selects the content of the active window, copies the content to the clipboard, and saves the content to a file. This file then gets read by some text editor, ...
0 votes
2 answers
386 views

Why tldr | xclip outputs escape codes looking like timestamp, and how to remove it?

Problem I want to copy the output of tldr to clipboard, and then paste that to text editor. I execute: tldr pwd | xclip -sel clip When I paste from clipboard, I get: pwd [0mPrint name of current/...
  • 411
1 vote
1 answer
346 views

How to persist the contents of the X11 (copy) clipboard on closing e.g. Vim to paste its contents later?

If I copy to X11 (copy) clipboard in Vim using "+y, I can only paste contents as long as Vim is open. The reason is as follows: From Ubuntu Wiki: ClipboardPersistence: The problem happens ...
  • 3,779
2 votes
2 answers
758 views

Linux clipboards, including with WSL consoles

It occurred to me that there are multiple clipboards on any given Linux console: First is the bash clipboard, this can be invoked by Ctrl-U / K, cut all line before (U) or after (K) cursor into ...
  • 601
0 votes
1 answer
309 views

how can I "pipe" all of these to xclip preservering newlines

So, I'm creating this little convenience command for system information when bug reporting. alias clip="xclip -selection clipboard -in" alias bug="echo $(lsb_release -irs && ...
0 votes
1 answer
163 views

Setting an alias for copying the current path from shell to clipboard fails [duplicate]

I have added the following alias to my .zshrc: alias pwdc="echo -n $PWD | xclip -selection clipboard" it seems the present working directory is not getting updated, when I move to a ...
1 vote
1 answer
3k views

Arch linux: set copy/paste/cut shortcuts

I would like to set custom keyboard shortcuts for using clipboard. I would like to change it from: Copy: ctrl + c in programs, ctrl + shift + c in terminal Paste: ctrl + v in programs, ctrl + shift + ...
  • 1,083
2 votes
1 answer
630 views

Copy file name without extension in Vifm

From the the Vifm wiki and using xclip, they show how to copy the filename of a selected file: nnoremap yn :!echo -n %c | xclip -selection clipboard %i<cr>:echo expand('%"c') "is ...
2 votes
1 answer
590 views

Piping to "xclip" doesn't survive bash script termination

I have an interactive fzf bash script that puts my choice into the X clipboard, like so: #!/bin/bash cat /path/to/file.txt | fzf | xclip -sel p -sel s -sel c exit 0 The text file contains some ...
3 votes
0 answers
424 views

xclip to multiple targets

How do I copy different texts to multiple targets using xclip (or other tools)? I tried doing echo "TEST_STRING" | xclip -selection clipboard -t STRING echo "TEST_HTML" | xclip -selection clipboard ...
  • 307
3 votes
0 answers
597 views

Copy any kind of file to clipboard with xclip

So, I want to be able to copy any kind of file to an X clipboard with a shell script (mostly as a means to copy files in ranger, to gui applications). So far i have this script: TYPE=$(file -b --mime-...
  • 31
0 votes
1 answer
3k views

No package found: install xclip in RHEL 7.6

I am new to the RHEL and want to install xclip package. I have tried yum install xclip It returned no package xclip
0 votes
1 answer
142 views

Firefox download file and copy to clipboard

For academic research I work with Firefox and many sites have the option to export entries as Bibtex files which opens a download dialog. I'm looking for a way to directly copy those files to the ...
0 votes
1 answer
89 views

Yank trimmed string in tmux copy mode

I am trying to yank string without trailing and heading spaces using this keybinding: bind-key -T copy-mode-vi z send-keys -X \ copy-pipe 'sed "s/^[[:blank:]]\+//;s/[[:blank:]]\+$//" | xsel -ib' ...
0 votes
1 answer
278 views

How to use existing terminal session to save output with ANSI escape code like `script` or `screen -L` do?

I run a python script on konsole to print long logging for few hours, then I realized I want to save its output with color, but it's too late to run either script or screen -L to save the output as ...
  • 4,756
3 votes
1 answer
912 views

Xclip command works in shell but not in keyboard shortcut

I have to paste my email often during the day, and typing it is time consuming. That is why I am searching for a way to do this with a button press. The following command works to place my mail on my ...
  • 157
2 votes
1 answer
50 views

Pbcopy acts as Pbpaste when symlinked

To keep my configs sane between environments, I thought it's a great idea to do the following on MacOS. ln -s /usr/bin/pbcopy /usr/local/bin/xclip However, my xclip symlink does not act just as ...
2 votes
1 answer
517 views

How to replace CTRL+C shortcut with same action plus xclip save copied selection command?

I am trying to be able to save/log all clipboard selection copies to a clipboard_histroy.log file. I want this to be able to simply append each copied selection to the log file but at the same time ...
  • 473
0 votes
2 answers
192 views

How to grab x characters long of start text from xclip selection and append to filename?

So I am trying to figure out how to add a title after the timestamp in my xclip script here. I would like it to grab about 24 characters worth of text from the beginning of each selection and save it ...
  • 473
1 vote
1 answer
178 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
0 answers
141 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 ...
6 votes
1 answer
733 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
2 answers
142 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 ...
  • 1
1 vote
0 answers
116 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
1 answer
217 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 ...
  • 131
1 vote
2 answers
397 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,235
5 votes
0 answers
12k 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
1 answer
960 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 ...
6 votes
1 answer
528 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 ...
10 votes
2 answers
3k 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 ...
1 vote
1 answer
7k 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 ...
  • 205
11 votes
2 answers
7k 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-...
9 votes
2 answers
1k 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 ...
  • 221
1 vote
1 answer
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
4 answers
3k 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 ...
  • 181
1 vote
0 answers
61 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
0 answers
938 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 ...
  • 95.7k
-3 votes
1 answer
1k 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 ...
  • 95.7k
4 votes
1 answer
265 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 ...
  • 95.7k
11 votes
1 answer
1k 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 ...
  • 603
2 votes
1 answer
536 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 ...
  • 177
93 votes
9 answers
94k 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-...
  • 37.7k
11 votes
1 answer
6k 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 ...
  • 323
16 votes
2 answers
4k 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 ...
  • 6,617