In Linux, use xclip

echo hi | xclip

Now its copied to the clipboard and you can paste it using, and this is important, the middle mouse button (and not Ctrl+v or Ctrl+V).

In termux, to copy some text use:

termux-clipboard-set some text

This text can now be pasted into other apps. termux-clipboard-set reads from standard input so you can do, for example

cat file.txt | termux-clipboard-set 

To copy what’s on the screen to the clipboard.