

If you omit localhost, that is export DISPLAY=:0.0, then xclip will fail on the remote node :Ĭonnect /tmp/.X11-unix/X0: No such file or directory While there are some recipies on Stack Overflow already, there is one glitch. enable X11 tunneling in ssh command: add -Y flag to ssh: ssh -Y.Make sure that /etc/ssh/nfig on the remote node has line X11Forwarding yes.in Git Bash use command export DISPLAY=localhost:0.0.I use VcXsrv, there are XMing and others.
COPY TEXT CLIPBOARD INSTALL
Install an X server to your Windows machine.xclip will send the clipboard to your X server, and the server will provide it to Windows. You need and X server on your Windows host and X-tunnelling in your ssh connection. 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? If you want to paste somewhere else other than a X application, try this one: cat file | xclip -selection clipboard Only copy the content to the X clipboard cat file | xclip This executes v as a command first and then substitutes it in-place for cd to use. To see how useful this is, imagine I want to open my current path in a new terminal window (there may be other ways of doing it like Ctrl+ T on some systems, but this is just for illustration purposes): Terminal 1: To simplify life, you can set up an alias in your. To paste the text you just copied, you shall use: xclip -o You can then pipe the output into xclip to be copied into the clipboard: cat file | xclip

I wrote down the complete procedure just in case anyone else needs it.įirst install a 16 kB program called xclip: sudo apt-get install xclip I always wanted to do this and found a nice and easy way of doing it.

How can I copy the output of a command directly into my clipboard?
