Skip to main content

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
69 views

nano command execution stuck

In nano v8.0 there's an option to send selection to X clipboard in the nanorc: "{execute}|xsel -ib{enter}{undo}" which does perfectly. I tried using xclip utility instead: "{execute}|...
Multifix's user avatar
  • 125
0 votes
1 answer
56 views

Find X Atom of given Window?

Using DWM as my Window-Manager under Archlinux I don't have any patches to handle context menus or "right-click" functionalities. This being the case I decided to write a concise Bash alias ...
tijko's user avatar
  • 265
0 votes
0 answers
12 views

Search selected word with shortcut in Wayland

I see here and here that wl-clipboard is supposed to be the xclip alternative for Wayland. But I don't seem to be able to fit it with what I do with xclip in X11, especially searching selected word ...
cipricus's user avatar
  • 1,629
0 votes
0 answers
30 views

Are there two different clipboards? Why does copy/paste work differently depending upon keys used (shift-insert & ctrl-v)? [duplicate]

It's as if there are two different system clipboards (stash places for copied text), with two different ways of accessing them. I've noticed this for quite some time but never been able to narrow it ...
raddevus's user avatar
  • 123
0 votes
1 answer
81 views

Is there a way to append text to xclip?

I need to store data in xclip multiple times - i.e. keep appending more chucks of text to xclip. But it doesn't look like this option is available. Is there a clever hack for this? I want to avoid ...
user167612's user avatar
  • 1,700
0 votes
1 answer
254 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 ...
user2741831's user avatar
0 votes
1 answer
201 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 ...
Archit's user avatar
  • 1
0 votes
2 answers
748 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 ...
nicolasbk's user avatar
1 vote
0 answers
506 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 ...
mangoduck's user avatar
2 votes
0 answers
421 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 ...
ecjb's user avatar
  • 445
1 vote
0 answers
245 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, ...
Chad Winters's user avatar
1 vote
2 answers
476 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/...
dungarian's user avatar
  • 445
1 vote
1 answer
612 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 ...
Shuzheng's user avatar
  • 4,601
3 votes
2 answers
1k 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 ...
YorSubs's user avatar
  • 641
0 votes
1 answer
394 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 && ...
xenoterracide's user avatar
0 votes
1 answer
275 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 ...
JammingThebBits's user avatar
3 votes
1 answer
7k 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 + ...
Jan Černý's user avatar
  • 1,441
2 votes
1 answer
971 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 ...
GhostOrder's user avatar
3 votes
1 answer
1k 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 ...
Stan Shank's user avatar
3 votes
0 answers
606 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 ...
Tohiko's user avatar
  • 307
4 votes
0 answers
801 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-...
Kivi's user avatar
  • 41
0 votes
1 answer
4k 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
rahul  Kushwaha's user avatar
0 votes
1 answer
195 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 ...
soelderer's user avatar
0 votes
1 answer
111 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' ...
vatosarmat's user avatar
0 votes
1 answer
417 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 ...
林果皞's user avatar
  • 5,206
3 votes
1 answer
1k 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 ...
RnRoger's user avatar
  • 157
2 votes
1 answer
74 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 ...
Andrei Cioara's user avatar
2 votes
1 answer
595 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 ...
Anonymous's user avatar
  • 533
0 votes
2 answers
223 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 ...
Anonymous's user avatar
  • 533
1 vote
1 answer
274 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 ➜ ~ ...
roachsinai's user avatar
1 vote
0 answers
145 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 ...
Nachtalb's user avatar
  • 113
7 votes
2 answers
914 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 -...
charlespwd's user avatar
0 votes
2 answers
169 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 ...
phil24's user avatar
  • 1
1 vote
0 answers
122 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 ...
Tomasz Kapłoński's user avatar
1 vote
1 answer
244 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 ...
Ramiro's user avatar
  • 131
1 vote
2 answers
441 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 ...
ka3ak's user avatar
  • 1,265
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 ...
Can Sürmeli's user avatar
1 vote
1 answer
2k 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 ...
Prgrm.celeritas's user avatar
6 votes
2 answers
574 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 ...
Brōtsyorfuzthrāx's user avatar
10 votes
2 answers
4k 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 ...
Alice Ryhl's user avatar
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 ...
SaAtomic's user avatar
  • 205
12 votes
2 answers
9k 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-...
Sancho Pancho's user avatar
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 ...
Kvass's user avatar
  • 221
1 vote
1 answer
2k 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-...
epsilonhalbe's user avatar
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 ...
Leon's user avatar
  • 191
1 vote
0 answers
65 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 ...
Mark A. Williams's user avatar
0 votes
0 answers
1k 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 ...
Tim's user avatar
  • 103k
-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 ...
Tim's user avatar
  • 103k
5 votes
2 answers
290 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 ...
Tim's user avatar
  • 103k
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 ...
Jeff Ward's user avatar
  • 663