Skip to content

Instantly share code, notes, and snippets.

@azlan
Last active January 5, 2025 08:39
Show Gist options
  • Save azlan/c664baaf3694f3160f2bbd4f04af8066 to your computer and use it in GitHub Desktop.
Save azlan/c664baaf3694f3160f2bbd4f04af8066 to your computer and use it in GitHub Desktop.
Bash script to copy terminal clipboard to OS clipboard with OSC52 from remote ssh session
#!/bin/bash
printf "\033]52;c;%s\007" "$(base64 | tr -d '\n')"
# https://jvns.ca/til/vim-osc52/
# Instructions:
# $ sudo nano /usr/local/bin/pbcopy
# paste this script
# $ sudo chmod +x /usr/local/bin/pbcopy
# example usage:
# $ ls | pbcopy
# if it's not working on your terminal emulator, read this:
# https://github.com/zyedidia/micro/blob/master/runtime/help/copypaste.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment