简体   繁体   English

将命令输出复制到Windows剪贴板

[英]Copying output of command to windows clipboard

I'm working with an ubuntu 16.04 VPS which I log into through putty from windows. 我正在使用Ubuntu 16.04 VPS,它是从Windows通过腻子登录的。 I want to copy the output of: 我想复制输出:

sudo nginx -T

to my windows clipboard. 到我的Windows剪贴板。 I've tried: 我试过了:

deploy@server:/etc/nginx/sites-available$ sudo nginx -T | xclip -selection c
Error: Can't open display: (null)
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

However nothing is copied to my local clipboard. 但是什么也不会复制到我的本地剪贴板。 How can I make this happen? 我怎样才能做到这一点?

you need to pass the $DISPLAY environment var to the command. 您需要将$ DISPLAY环境var传递给命令。 Run it like this: 像这样运行它:

DISPLAY=:0 sudo nginx -T | xclip -selection c

if xclip doesnt work the you can also try using xsel 如果xclip不起作用,您也可以尝试使用xsel

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM