关闭

pbpaste & pbcopy in Mac OS X (or: Terminal + Clipboard = Fun!)

414人阅读 评论(0) 收藏 举报
分类:

本文转载至:https://langui.sh/2010/11/14/pbpaste-pbcopy-in-mac-os-x-or-terminal-clipboard-fun/

The OS X shell is very powerful, but some wonderfully useful commands are almost entirely unknown to the community at large. Two of these forgotten commands are pbcopy and pbpaste. Let's take a quick look at what they can do.

pbcopy

This command allows you to copy text from stdin into the clipboard1 buffer. Trivial example:

echo 'Hello World!' | pbcopy

"Hello World!" is now in your clipboard.

pbpaste

Pastes from your clipboard to stdout. Trivial example:

echo `pbpaste`

This will echo the contents of your clipboard. If you're following along you'll see "Hello World!".

What Can I Do With These?

What can't you do! Oh, you want examples? Well...

  • You could grab the output of a grep/awk/sed to paste into IM/IRC.

  • You could use a macro tool (like iKey, QS, et cetera) to create text modifying workflows that grab highlighted text, manipulate it, and replace it inline.

  • You could pull changelogs from svn into the clipboard when tagging for release so you could email them to coworkers.

Let me know what amazing things you come up with to enhance your own productivity!


0
0
查看评论

shell paste指令:用于不同文件的合并粘贴

原文地址:http://blog.csdn.net/anders_zhuo/article/details/8461641paste paste命令用于将文本文件或标准输出中的内容粘贴到新的文件,它可以将来自于不同文件的数据粘贴到一起,形成新的文件 paste [选项] 文件1 文件2 -...
  • wonengguwozai
  • wonengguwozai
  • 2017-07-18 17:08
  • 315

pbpaste & pbcopy in Mac OS X (or: Terminal + Clipboard = Fun!)

The OS X shell is very powerful, but some wonderfully useful commands are almost entirely unknown to the community at large. Two of these forgotten co...
  • angel22xu
  • angel22xu
  • 2015-05-20 16:44
  • 1350

Mac OS X 命令行用户应当知道的八个终端工具

原文链接:Eight Terminal Utilities Every OS X Command Line User Should Know OS X  的Terminal 终端开辟了强大的UNIX实用工具和脚本的世界。如果你是从Linux转移过来的用户,你会在OS X 终端上发现很...
  • qq_19732563
  • qq_19732563
  • 2015-09-30 09:35
  • 1703

Linux: xclip,pbcopy,xsel用法 terminal 复制粘帖 (mac , ubuntu)

来自:ITEYE 作者:天梯梦 1. Windows下   使用系统自带的clip命令。 # 位于C:\Windows\system32\clip.exe。   示例: C代码   ec...
  • jiangh33
  • jiangh33
  • 2014-12-14 17:42
  • 1595

pbpaste & pbcopy in Mac OS X (or: Terminal + Clipboard = Fun!)

本文转载至:https://langui.sh/2010/11/14/pbpaste-pbcopy-in-mac-os-x-or-terminal-clipboard-fun/ The OS X shell is very powerful, but some wonderfully us...
  • robertsong2004
  • robertsong2004
  • 2017-01-03 10:14
  • 414

PB从剪贴板取图并保存

结构体定义 [cpp] view plaincopy type bitmapinfoheader from structure       long&...
  • lwj0310
  • lwj0310
  • 2014-04-30 12:18
  • 1395

MAC OS X 命令行工具Terminal实用插件oh-my-zsh官方说明与安装引导

oh-my-zsh官方说明与安装引导 oh-my-zsh is an open source, community-driven framework for managing your ZSHconfiguration. It comes bundled with a ton of helpful...
  • haoxuliangdev
  • haoxuliangdev
  • 2013-09-04 10:26
  • 6227

mac os x 终端 采用 Solarized 配色方案

要在 Mac OS X 终端里舒服的使用命令行(至少)需要给3个工具配色,terminal、vim 和 ls. 1、Terminal (1)下载 Solarized ,在终端运行如下命令 $ git clone git://github.com/altercation/solarized.g...
  • xiaofei125145
  • xiaofei125145
  • 2015-08-16 15:18
  • 6032

让 emacs 在命令行下支持剪切板共享

1、在网上广为流传的一种让emacs和系统剪切板共享的方法是在.emacs文件中加入
  • nicekwell
  • nicekwell
  • 2014-10-14 02:22
  • 1731

PB 操作EXCEL表的方法

PB中操作Excel的技巧集一 创建Excel对象  eole=CREATEOBJECT("Excel.application")  2.添加新工作簿   eole.Workbooks.add  3.设置第3个工作表为激活工作表 ...
  • samrtian
  • samrtian
  • 2015-07-14 13:51
  • 3850
    个人资料
    • 访问:2753060次
    • 积分:31135
    • 等级:
    • 排名:第184名
    • 原创:433篇
    • 转载:1011篇
    • 译文:147篇
    • 评论:102条
    技术链接
    最新评论