http://justcoding.iteye.com/blog/1829963linux
1. Windows下ubuntu
使用系统自带的clip
命令。
# 位于C:\Windows\system32\clip.exe
。bash
示例:app
2. Ubuntu下ssh
ubuntu下的用户能够只用apt-get来安装:编辑器
xclip能够将内容输出到‘X’的剪切板中,好比:oop
执行这个命令后你就能够用鼠标中键来在X程序中将内容粘贴出来。可是更多的时候,咱们须要不单单把内容输出到‘X’的剪切板中,而是但愿能够在 GUI程序 中用ctrl + v也能够粘贴(好比,输出到gnome的剪切板中),下面这段命令就可让你将内容输出到gnome的剪切板中:this
再在一个GUI程序中按下ctrl + v,看下是否是粘贴上去了呢?顺着这个命令,我也从新写了一下ifconfig,让它在执行后输入内容到终端的同时,也将ip地址输出到剪切板中,由于一般状况下,查看ifconfig就是为了获取机器的ip地址:spa
或者.net
此时你就能够在网页等编辑框CTRL+V了。
项目主页:http://sourceforge.net/projects/xclip/
命令man page: http://linux.die.net/man/1/xclip
-i, -in read text into X selection from standard input or files (default) -o, -out prints the selection to standard out (generally for piping to a file or program) -f, -filter when xclip is invoked in the in mode with output level set to silent (the defaults), the filter option will cause xclip to print the text piped to standard in back to standard out unmodified -l, -loops number of X selection requests (pastes into X applications) to wait for before exiting, with a value of 0 (default) causing xclip to wait for an unlimited number of requests until another application (possibly another invocation of xclip) takes ownership of the selection -d, -display X display to use (e.g. "localhost:0"), xclip defaults to the value in $ DISPLAY if this option is omitted
使用xsel
命令。
示例:
4. Mac下
使用pbcopy
命令。 # 对应有个pbpaste
命令。
示例:
命令的结果输出时,若是给复制命令(即上面提到的命令clip、xsel、pbcopy)那么命令输出就看不到了。若是你想先看到命令的输出,能够下面这么作。
tee
命令把输出输到控制台和一个文件中。命令执行完成后,再把输出的内容放到剪贴板中。
使用下面的命令: