cmd 复制到剪贴板命令_从命令行复制到剪贴板

cmd 复制到剪贴板命令

If you've ever been debugging with a fellow developer, you'll hear "OK, execute that and let me know what it says".  In this case, you can either manually copy the output and instant message the text over to them, or you can write the output to file with >> , open the file, manually copy the contents, and paste it into IM.  I experience this for a few hours recently and it was way to much work!  Shouldn't there be a way to quickly place an execution's output directly into the clipboard just to save some time?  You can with pbcopy!

如果您曾经与其他开发人员一起进行调试,您会听到“确定,执行该命令,让我知道它在说什么”。 在这种情况下,您可以将输出和即时消息文本手动复制到它们,也可以使用>>将输出写入文件,打开文件,手动复制内容,然后将其粘贴到IM中。 我最近经历了几个小时,这是很多工作的方式! 难道没有一种方法可以将执行的输出直接直接放置到剪贴板中以节省时间吗? 您可以使用pbcopy

将标准输出复制到剪贴板 (Copy stdout to Clipboard)

You'll use a single pipe to transfer the stdout result into the clipboard:

您将使用单个管道将标准输出结果传输到剪贴板:


# command | pbcopy
hg diff | pbcopy


The git diff information is copied to the clipboard in this example; now you can show your colleague what you've changed.

在此示例中, git diff信息被复制到剪贴板。 现在您可以向您的同事展示您所做的更改。

将文件内容复制到剪贴板 (Copy File Contents to Clipboard)

In the case of copying file contents into the clipboard, pbcopy goes first:

如果将文件内容复制到剪贴板,则pbcopy首先执行:


# pbcopy < file.ext
pbcopy < circle.yml


The complete file contents are instantly copied to the clipboard for easy sharing.

完整的文件内容将立即复制到剪贴板,以方便共享。

粘贴到文件 (Pasting to File)

So what if you want to paste the clipboard contents into a new or existing file?  Use pbpaste:

那么,如果要将剪贴板内容粘贴到新文件或现有文件中怎么办? 使用pbpaste


#pbpaste > file.txt
pbpaste > commands.txt


The clipboard contents will be placed into the given file.

剪贴板中的内容将放入给定文件中。

pbcopy will be a big timesaver for me moving forward.  Manually copy and pasting information is with the mouse or trackpad is inconvenient and time-consuming.  These types of command line techniques can make us more proficient, skilled developers!

pbcopy对于我前进将是一个巨大的pbcopy时间。 用鼠标或触控板手动复制和粘贴信息既不方便又耗时。 这些类型的命令行技术可以使我们变得更加熟练,技术熟练的开发人员!

翻译自: https://davidwalsh.name/copy-clipboard-command-line

cmd 复制到剪贴板命令

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值