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
时间。 用鼠标或触控板手动复制和粘贴信息既不方便又耗时。 这些类型的命令行技术可以使我们变得更加熟练,技术熟练的开发人员!
cmd 复制到剪贴板命令