tty-copy
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.
Supported Terminals
Here is a non-exhaustive list of the status of popular terminal emulators regarding OSC52 [1]:
Terminal | OSC 52 support |
---|---|
yes |
|
yes |
|
yes |
|
GNOME Terminal (and other VTE-based terminals) |
|
yes |
|
yes |
|
yes (to be confirmed) |
|
yes |
|
no, but see workaround |
|
yes |
|
yes (with a script, see here) |
|
yes |
Requirements
-
UNIX-like system
-
C compiler and linker supporting at least C99 (tested with clang and gcc)
-
Asciidoctor (for building man pages)
Installation
On Alpine Linux
Install package tty-copy from the Alpine’s Edge community repository:
apk add tty-copy
On Fedora
Install package tty-copy from the Fedora repositories (since Fedora 35):
dnf install tty-copy
Using Pre-Built Binary
-
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.
From Source Tarball
wget https://github.com/jirutka/tty-copy/archive/v0.2.2/tty-copy-0.2.2.tar.gz
tar -xzf tty-copy-0.2.2.tar.gz
cd tty-copy-0.2.2
make build
make install DESTDIR=/ prefix=/usr/local
Credits
This program is inspired from termcopy and vim-oscyank.
License
This project is licensed under MIT License. For the full text of the license, see the LICENSE file.