xclip is a command line interface to the X11 clipboard.
Questions tagged [xclip]
46 questions
1
vote
1 answer
xclip check if "selection" is empty
As an FYI this is on Linux.
I want to have one of the options in a script to be to pull the selected text. So I start my script
#!/bin/bash
xclip -o > ~/bin/temp.txt
However, if I don't have anything selected this throws the error
./test
Error:…

user1543042
- 3,422
- 1
- 17
- 31
1
vote
1 answer
Vim, yanking with xclip, getting rid of escape characters
I am using vim to edit files on several systems through ssh, some of which have or do not have -clipboard option compiled in. Therefore I have been trying to use xclip to copy some parts of the text into the X clipboard, which is then promptly piped…

wuzwm
- 501
- 1
- 5
- 11
1
vote
2 answers
xclip and trailing spaces
I use xclip to get my current path in my clipboard this way :
pwd | xclip -selection c
it almost works : if you paste (ctrl v) in an empty file, you will see that there is a trailing carriage return. It's very annoying since if you past in a term,…

Benibur
- 816
- 10
- 9
1
vote
1 answer
Sending Strings Queue to Clipboard in python
I am writing a program that runs in background and check's for file changes in a folder if any new Image file arrives into that folder it will read text from that Image with the help of tesseract OCR Engine.Images contains Adresses of…

user159561
- 9
- 1
- 7
1
vote
2 answers
Unexpected EOF in .bashrc alias
I am getting an unexpected end of file error after including this line in my .bashrc
alias domsrv01='echo -e ?HT_R8\'% | xclip ; ssh 10.50.0.35'
The desired exit from echo to xclip is:
?HT_R8'%
As you may guess, it's a password and I can't change…

sergei
- 73
- 1
- 1
- 7
0
votes
0 answers
Why can't I paste using python3 pyperclip in Debian 12?
In Chapter 6 of Automate the Boring Stuff with Python (by Sweigart) the following example usage of pyperclip is given for copying 'Hello, world'! to the clipboard. However when pressing Ctrl + V in a text editor after running the example code,…

James
- 1
- 1
0
votes
0 answers
xclip -selection returning last selected text when nothing is selected
Problem using xclip to output current highlighted text to stdout:
xclip -o -selection
When text is selected/highlighted in the desktop gui, it sends that text to stdout, as expected. But if I then deselect the text, and run the xclip command again,…

markling
- 1,232
- 1
- 15
- 28
0
votes
0 answers
Is there anyway to fix the xclip relate with neovim "+y?clipboard: error: Error: target STRING not available
When use neovim to copy content to system clipboard with "+y way. It works well if neovim's window doesn't close, if I close neovim window, the content of + register will disappear.
for example, then if I use tow neovim, one copy someword, another…
0
votes
0 answers
xclip not getting stdin from pexpect, or pexpect not sending?
This
import pexpect
def run(cmd, stdin):
child = pexpect.spawn(cmd, encoding='utf-8')
child.send(stdin)
child.sendeof()
run('xclip -selection clipboard', 'lol')
should copy string lol into my clipboard, so that I paste it around by…

caveman
- 422
- 3
- 17
0
votes
1 answer
Programmatically Executing Clipboard Contents within Bash Shell (or Better Approach)
I'm currently working on a bash script which will send the current timestamp and the IP of a system (running Ubuntu 18.04 LTS) to a Slack channel using a webhook as shown below:
##!/bin/bash
command=(curl -X POST -H \'Content-type:…

bmcgannon
- 13
- 3
0
votes
0 answers
Fish shell function behave differently when called using $TERM -e
I have the following fish function, that passes a list of words to fzf and once I select one, it removes the line break from the end and send it to the clipboard.
function spell_checker
fzf < /usr/share/dict/words | tr -d '\n' | xclip -selection…

sandygk
- 46
- 5
0
votes
0 answers
KDE Custom shortcut to re-implementing copy paste (could DBus work ?)
I'm on KDE in french and I use the Raccourcis Personalisés menu to create custom keyboard shortcuts, I would like ⊞ Windows+C and ⊞ Windows+V to be copy (bash xclip -selection clipboard) and paste (xclip -selection clipboard) but writing those…

Robert Vanden Eynde
- 681
- 1
- 7
- 18
0
votes
1 answer
Code in Shell Script runs before other Operations
This same problem is better formulated in a question posted to the Unix & Linux StackExchange community.
I am programming a script which opens on a key press, open a new terminal (gnome-terminal), runs scrot (screenshot tool), saves the picture…

Timon .D
- 21
- 3
0
votes
1 answer
How to copy output of command line from remote, to local clipboard via ssh
I am using HPC on campus and it is CentOS. I asked administrator to install xclip in HCP. But he said it would endanger to HPC. I am not root user. I am wondering whether there is a way to I can copy output of command line to clipboard directly…

Mike Brown
- 331
- 2
- 12
0
votes
2 answers
when linux system calls scripts some commands don't work ( cron / if-up.d )
Hi I'm trying to run a script that calls xclip in order to have a string ready to paste when i connect to the internet.
I have a script /etc/network/if-up.d/script that does execute when connecting (i make him post a date in a file succesfuly ) but…

Lau Llobet
- 577
- 7
- 21