✨ v1.2.0: OSC 52 Remote Copy, Shell Completions & Clear Buffer

Clipboard management at the speed of your shell.

clip is a lightweight, zero-dependency CLI wrapper that provides a seamless, unified clipboard experience across Wayland, X11, macOS, WSL, and remote SSH sessions.

Quick Install (One-liner)bash
curl -sL https://git.io/clipinstall | bash

Try It Online: Interactive Terminal Playground

Simulate running clip commands and inspect the live clipboard buffer in real time.

clip interactive terminal simulator
Wayland (wl-copy)
Interactive clip Simulator initialized. Click a preset command below or type your own.
$

📋 Simulated Clipboard

16 bytes
Hello from clip!
Try Preset Commands:

Why use clip?

Native clipboard tools like xclip, wl-copy, and pbcopy have inconsistent syntax and flags. clip standardizes your workflow across all environments.

⚡

Auto Display Detection

Detects whether you are running under Wayland (wl-copy), X11 (xclip or xsel), macOS (pbcopy), or WSL. No flags required.

🌐

OSC 52 Remote Copy

Copy over plain SSH sessions and inside tmux directly to your local computer clipboard via ANSI escape sequences (--osc52). Zero forwarding required.

✂️

Trim Trailing Newlines

Tired of unwanted newlines when copying API keys, paths, or passwords? Use -n or --trim to cleanly strip the trailing newline.

📋

Bidirectional Paste

Not just copying—run clip -p to dump clipboard data directly into standard output, pipes, or files. You can also symlink it as paste.

🧹

Wipe Buffer (-c / --clear)

Clear your active clipboard buffer instantly using clip -c to protect sensitive passwords or credentials after pasting.

⌨️

Shell Completions

Includes native tab-completion scripts for Bash, Zsh, and Fish shells. Installed automatically with make install.

Common Usage Patterns

Explore everyday shell workflows made easier with clip.

1. Piping Command Output

Send the output of any command pipeline straight to the clipboard:

Example: Pipe date into clipboardbash
date -I | cut -d- -f2 | clip

2. Trimming Trailing Newline (-n)

Essential when copying paths, passwords, or authentication tokens into forms or terminal prompts:

Example: Copy working directory without trailing newlinebash
pwd | clip -n

3. Remote SSH Copying with OSC 52

When logged into remote cloud servers or inside Docker containers without X11 or Wayland:

Example: Copy from remote server directly to local laptop clipboardbash
cat /etc/hostname | clip --osc52

4. Pasting from Clipboard (-p / --paste)

Extract current clipboard content and pipe to other utilities:

Example: Paste operationsbash
# Print to terminal
clip -p

# Save to a file
clip -p > notes.txt

# Pipe to grep or jq
clip -p | jq '.'

Platform Support Matrix

clip inspects your environment variables and available utilities to select the fastest native backend.

EnvironmentConditionCopy UtilityPaste Utility
Wayland$WAYLAND_DISPLAY setwl-copywl-paste
X11 (Primary)$DISPLAY set & xclipxclip -inxclip -out
Remote SSH / Headless--osc52 or SSH sessionOSC 52 ANSI escapeN/A (terminal restricted)
macOSpbcopy command foundpbcopypbpaste
Windows / WSLclip.exe command foundclip.exepowershell Get-Clipboard

Command-Line Reference

Complete flag manual and options reference for clip.

-p, -o, --pasteAction

Outputs current clipboard contents to standard output. Cannot be combined with file arguments.

-c, --clearAction

Clears the active system clipboard buffer immediately.

--osc52Backend

Forces use of OSC 52 terminal ANSI escape sequence to copy data over SSH or inside tmux sessions.

-n, --trimFilter

Strips the single trailing newline character (\n) from incoming data before saving to clipboard.

-s, --primaryBuffer

Targets the primary mouse selection buffer instead of the default clipboard buffer (supported on X11, Wayland, and OSC 52).

-h, --helpInfo

Displays standard command-line usage summary, supported options, and exits with code 0.

-v, --versionInfo

Displays the current release version of clip and exits with code 0.

Installation Methods

Choose the installation method that fits your environment best.

Method 1: via Makefile (Recommended)

Installs binary, man page, and autocompletion scripts for Bash, Zsh, and Fish.

Build with Makefilebash
git clone https://github.com/joshuacox/clip.git\ncd clip\nsudo make install

Method 2: Quick Installer

Downloads and executes the bootstrap installer automatically.

Quick Installbash
curl -sL https://git.io/clipinstall | bash

Method 3: via Nix Flake

Run directly without installing, or install to your user profile.

Nix Flakebash
nix run github:joshuacox/clip -- --help\nnix profile install github:joshuacox/clip

Method 4: via Homebrew (macOS / Linux)

Install using the included Homebrew formula.

Homebrewbash
brew install joshuacox/clip/clip