Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

copy file content using terminal [closed]

Tags:

terminal

macos

I am looking to copy txt file content to clipboard so that I will be able to paste it somewhere else (using MAC terminal). Normally, I am supposed to select the text content and make a copy. That is not convenient in my case since the content is too large too scrolled all the way down. Is there a Linux shortcut that I can use to copy the content within a single command? I have heard about cat, yet that did not work in my case.


1 Answers

Use pbcopy:

cat myfile.txt | pbcopy

More examples.

like image 107
lefloh Avatar answered May 10 '26 13:05

lefloh