In Mac you can use pbcopy
:
$ pbcopy < hello.txt
In Linux which is using X11 (I am using ubuntu), you can use xsel
command:
$ sudo apt install xsel
$ xsel -b < hello.txt
To copy some program's output to clipboard, we can use pipe:
$ date | sel -b
Then if you use "ctrl-v", you will see the copied date.