A utility for copying content to the system clipboard from anywhere via a TTY and terminal using the ANSI OSC52 sequence. It works in any terminal session, whether local, remote (e.g. SSH), or even nested therein!
Refer to tty-copy(1) for usage information.
Here is a non-exhaustive list of the status of popular terminal emulators regarding OSC52 [1]:
Terminal | OSC 52 support |
---|---|
yes |
|
yes |
|
yes |
|
yes |
|
GNOME Terminal (and other VTE-based terminals) |
|
yes |
|
yes |
|
yes (since 24.12) |
|
yes (to be confirmed) |
|
yes |
|
no, but see workaround |
|
yes |
|
yes (with a script, see here) |
|
yes |
-
UNIX-like system
-
C compiler and linker supporting at least C99 (tested with clang and gcc)
-
Asciidoctor (for building man pages)
Install package tty-copy from the Fedora repositories (since Fedora 35):
dnf install tty-copy
-
Download and verify tty-copy binary for your CPU architecture (pick the right link from the list above), for example:
curl -sSLO https://github.com/jirutka/tty-copy/releases/download/v0.2.2/tty-copy.x86_64-linux curl -sSL https://github.com/jirutka/tty-copy/releases/download/v0.2.2/checksums.txt | sha256sum -c --ignore-missing
-
Install
tty-copy
somewhere on yourPATH
, e.g./usr/local/bin
:install -m 755 tty-copy.* /usr/local/bin/tty-copy
All binaries are statically linked with musl libc, so they work on every Linux system (distro) regardless of used libc.
This program is inspired from termcopy and vim-oscyank.
This project is licensed under MIT License. For the full text of the license, see the LICENSE file.