平時(shí)工作主要使用命令行,在Mac中也提供了相應(yīng)的復(fù)制粘貼的命令,這樣省去了很多操作鼠標(biāo)的時(shí)間
參考:http://osxdaily.com/2007/03/05/manipulating-the-clipboard-from-the-command-line/
復(fù)制
簡而言之,如果想復(fù)制一個(gè)文件的內(nèi)容
pbcopy < file.txt
這時(shí)文件內(nèi)容已經(jīng)拷貝到剪切板中去了。
命令行的好處是提供了極大的靈活性,比如使用pipe可以結(jié)合
find,grep,awk,cut等命令組合或過濾目標(biāo)內(nèi)容
這個(gè)例子把docker image中所有與iis-有關(guān)的image內(nèi)容復(fù)制到剪切板了
docker images | grep "iis-" | pbcopy
再舉一個(gè)很簡單的例子
echo "this is a demo" | pbcopy
粘貼
pbpaste
把內(nèi)容輸出到其他文件中
pbpaste > file.txt
過濾輸出的內(nèi)容
pbpaste | grep "xxx"