Copy & Paste in Terminal

Mac provides the command line for copy and paste, useful for some tasks.

refer link:http://osxdaily.com/2007/03/05/manipulating-the-clipboard-from-the-command-line/

Copy

copy the content of the file

pbcopy < file.txt

now the content is in clipboard, ready to be pasted

you can use pipe to combine command such as find,grep, awk and cut to filter and aggregate data.

for example:

docker images | grep "iis-" | pbcopy
echo "this is a demo" | pbcopy

Paste

pbpaste

redirect content to a file

pbpaste > file.txt
pbpaste | grep "xxx"

猜你喜欢

转载自www.cnblogs.com/chengdol/p/10448016.html
今日推荐