Mosh and OSC sequences: clipboard (OSC 52), titles, hyperlinks, OSC 7 and OSC 133
Mosh keeps its own copy of the screen, so only OSC sequences it understands reach your terminal. OSC 52 and titles pass; OSC 7, 133 and 9;4 do not.
With SSH, every byte a program prints travels unchanged to your terminal. Mosh works differently: mosh-server runs its own terminal emulator on the host, keeps the screen state, and sends your device the changes. A control sequence has an effect on your side only if Mosh models it. The others are dropped on the host. See How Mosh works.
OSC (Operating System Command) sequences are the ones most affected, because they carry things that are not drawn on the screen: the clipboard, the window title, links, the current directory and shell integration marks.
What Mosh passes on
In the current release, Mosh 1.4.0, the terminal code handles these OSC commands:
- OSC 0, 1 and 2: icon name and window title.
- OSC 52 with the
c(clipboard) selection: copy to the clipboard. Mosh 1.4.0 added "OSC 52 clipboard copy integration", so both ends need 1.4.0 or later. Programs such as tmux and vim plugins that copy through OSC 52 then work over Mosh, if your terminal app accepts OSC 52.
This app does not act on OSC 52 copy requests. To copy text in the app, see Copy, paste and select.
What is dropped
- OSC 7 (current directory), used by some terminals to open new tabs in the same folder. A 2014 issue reports that Mosh discards OSC sequences other than the title ones; an OSC 7 change was proposed in 2026 and was still open.
- OSC 133 (shell integration or semantic prompts: where a prompt starts and ends). A feature request was opened in April 2026.
- OSC 9;4 (progress) and other terminal-specific OSC sequences are not among the commands Mosh handles.
- OSC 8 (hyperlinks): support was merged into Mosh's development branch in March 2026. The latest release, 1.4.0 from October 2022, does not have it.
What to do
- If you need one of the dropped features, use SSH for that session, or run tmux on the host and connect with SSH when you need it. See Mosh or SSH?.
- Make sure both ends run Mosh 1.4.0 or later for OSC 52 copy and true color.
- Inside tmux over Mosh, tmux must also be set to pass OSC 52 through (its
set-clipboardoption); see the tmux manual.
Related
- How Mosh works
- Mosh or SSH?
- Mosh scrollback is incomplete, and how to use the mouse
- Escape sequences
- App guide: Copy, paste and select
Sources
- Mosh 1.4.0 release notes (OSC 52 clipboard copy, true color)
- Mosh 1.4.0 source: OSC_dispatch in src/terminal/terminalfunctions.cc
- mosh issue 552: OSC 7 is not passed to the client
- mosh pull request 1383: Add OSC 7 support
- mosh issue 1385: OSC 133 shell integration support
- mosh pull request 1360: Add OSC 8 hyperlink support (merged March 2026)
- tmux(1) manual: set-clipboard