1TTY-COPY(1) TTY-COPY(1)
2
3
4
6 tty-copy - copy content to the system clipboard via TTY
7
9 tty-copy [options] [<text...>]
10
12 tty-copy copies the given text to the controlling TTY using OSC 52
13 escape sequence and base64 encoding. If no text is given, tty-copy
14 copies data from its standard input.
15
16 This allows terminals that support OSC 52 to copy the data into the
17 system clipboard. It works in any terminal session, whether local,
18 remote, or even nested therein! The supporting terminal must obviously
19 (a) support OSC 52 and (b) have permission to access the clipboard.
20
21 The maximum length of an OSC 52 escape sequence is originally 100 000
22 bytes in total which means 74 994 bytes of plain text. However, some
23 terminal emulators have higher limit; for example, kitty allows up to 8
24 MiB by default.
25
26 For the specification see the section Operating System Controls, code
27 52, Manipulate Selection Data, in Xterm Control Sequences
28 (https://www.xfree86.org/current/ctlseqs.html).
29
31 -c, --clear
32 Instead of copying anything, clear the clipboard so that nothing is
33 copied.
34
35 -n, --trim-newline
36 Do not copy the trailing newline character.
37
38 -o <file>, --output <file>
39 Path of the terminal device (defaults to /dev/tty).
40
41 -p, --primary
42 Use the “primary” clipboard (selection) instead of the regular
43 clipboard.
44
45 -T <type>, --term <type>
46 Specify the type of the terminal. Currently, only "screen" and
47 "tmux" are recognized, any other value is interpreted as the
48 default.
49
50 If not specified, "screen" and "tmux" are autodetected based on the
51 TERM and TMUX environment variables.
52
53 -t, --test
54 Test whether your terminal processes the OSC 52 escape sequence —
55 if it does, exits with status code 0, otherwise with 1.
56
57 The fact that the terminal processes the sequence does not
58 necessarily mean that access to the system clipboard will work — it
59 may be disabled. This option only tests if the sequence is
60 intercepted by the terminal or visibly printed on the screen.
61
62 -V, --version
63 Display the version of tty-copy and exit.
64
65 -h, --help
66 Display the help message and exit.
67
69 • 0 — Clean exit, no error has encountered.
70
71 • 1 — General error.
72
73 • 10 — Invalid usage.
74
75 • 11 — I/O error.
76
78 Jakub Jirutka
79
81 Report bugs to the project’s issue tracker at
82 https://github.com/jirutka/tty-copy/issues.
83
84
85
86 2023-01-21 TTY-COPY(1)