xclip

How can I copy the contents of a file directly into my Windows clipboard when I'm running the command on a remote Linux machine via ssh in Git Bash?

天涯浪子 提交于 2020-02-16 10:41:33
问题 I'm using Windows 10. I open Git Bash and then ssh into an Ubuntu server. Often I want to copy the whole contents of a large text file. Rather than using scp to download the file to my Windows machine, I sometimes would rather quickly copy the contents to my clipboard. Using cat and then scrolling thousands of lines and then manually copying to clipboard is possible but isn't practical. I'd rather pipe cat to a command that copies the output to my Windows clipboard. Or call some other command

How can I copy the contents of a file directly into my Windows clipboard when I'm running the command on a remote Linux machine via ssh in Git Bash?

倾然丶 夕夏残阳落幕 提交于 2020-02-16 10:41:08
问题 I'm using Windows 10. I open Git Bash and then ssh into an Ubuntu server. Often I want to copy the whole contents of a large text file. Rather than using scp to download the file to my Windows machine, I sometimes would rather quickly copy the contents to my clipboard. Using cat and then scrolling thousands of lines and then manually copying to clipboard is possible but isn't practical. I'd rather pipe cat to a command that copies the output to my Windows clipboard. Or call some other command

How to clear both clipboards securely in Gnome, from Python?

佐手、 提交于 2019-12-23 12:57:42
问题 Gnome desktop has 2 clipboards, the X.org (saves every selection) and the legacy one (CTRL+C). I am writing a simple python script to clear both clipboards, securely preferably, since it may be done after copy-pasting a password. The code that I have seen over here is this: # empty X.org clipboard os.system("xclip -i /dev/null") # empty GNOME clipboard os.system("touch blank") os.system("xclip -selection clipboard blank") Unfortunately this code creates a file named blank for some reason, so

Keyboard shortcuts in Tmux deactivated after using xclip

≯℡__Kan透↙ 提交于 2019-12-21 04:57:05
问题 I am using the following configuration in my .tmux.conf to copy text to-and fro from xclip bind C-c run "tmux save-buffer - | xclip -i -sel clipboard" bind C-v run "tmux set-buffer \"$(xclip -o -sel clipboard)\"; tmux paste-buffer" If I run C-prefix C-c for e.g, the text is pasted into another application but after that none of the tmux commands work in the tmux terminal (e.g. C-prefix [ to go into copy-mode etc.) What is wrong in my config? 回答1: According to https://wiki.archlinux.org/index

Python script using subprocess and xclip hangs if piped in bash

老子叫甜甜 提交于 2019-12-11 01:58:56
问题 I have a python script that needs to output some values to stdin and copies another string to clipboard. I'm using the module subprocess to execute the xclip utility through Popen something like this: # clip.py import subprocess from subprocess import Popen print('PRINT_ME') p1 = Popen(['xclip', '-selection', 'clipboard'], stdin=subprocess.PIPE) p1.communicate(input=('PASTE_ME'.encode())) The script works as intended: PRINT_ME is echoed in bash and PASTE_ME is available to paste, and returns

Paste clipboard content into a variable in bash using xclip

最后都变了- 提交于 2019-12-10 10:26:49
问题 I know this command will paste the clipboard contents into a file: xclip -out -selection clipboard >> file.txt If I want to paste clipboard content into a variable like a string what do I do? 回答1: To assign the output of a command to a variable, you can use command substitution: myvar=$( command ) echo "$myvar" 来源: https://stackoverflow.com/questions/23046580/paste-clipboard-content-into-a-variable-in-bash-using-xclip

Paste clipboard content into a variable in bash using xclip

眉间皱痕 提交于 2019-12-05 21:05:23
I know this command will paste the clipboard contents into a file: xclip -out -selection clipboard >> file.txt If I want to paste clipboard content into a variable like a string what do I do? To assign the output of a command to a variable, you can use command substitution: myvar=$( command ) echo "$myvar" 来源: https://stackoverflow.com/questions/23046580/paste-clipboard-content-into-a-variable-in-bash-using-xclip

xclip does not terminate when tracing it

那年仲夏 提交于 2019-12-01 05:19:16
I have made the following observations: $ xclip text.txt The execution terminates instantly, it copies the content of text.txt to the default selection XA_PRIMARY which means you can paste it through your middle mouse button or xclip -o . When I want to see what xclip is doing, it does not terminate anymore: $ xclip -verbose text.txt Connected to X server. Using UTF8_STRING. Reading text.txt... Waiting for selection requests, Control-C to quit Waiting for selection request number 1 It does not terminate until I select something in my X11 system, for instance this very output I have pasted here

xclip does not terminate when tracing it

我怕爱的太早我们不能终老 提交于 2019-12-01 02:44:15
问题 I have made the following observations: $ xclip text.txt The execution terminates instantly, it copies the content of text.txt to the default selection XA_PRIMARY which means you can paste it through your middle mouse button or xclip -o . When I want to see what xclip is doing, it does not terminate anymore: $ xclip -verbose text.txt Connected to X server. Using UTF8_STRING. Reading text.txt... Waiting for selection requests, Control-C to quit Waiting for selection request number 1 It does