osc52
A command line tool to copy text to the system clipboard from anywhere using the ANSI OSC52 sequence.
When this sequence is printed, the terminal will copy the given text into the system clipboard. This is totally location independent, users can copy from anywhere including from remote SSH sessions.
OSC52 is widely supported, see partial list of supported terminals
Installation
go install -v github.com/theimpostor/osc52@latest
Usage
Usage: ./osc52 [file1 [...fileN]]
Copies file contents to system clipboard using the OSC52 escape sequence.
With no arguments, will read from stdin.
Credits
Credit and thanks to the the vim-ocsyank plugin