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.
curl -sL https://git.io/clipinstall | bashTry It Online: Interactive Terminal Playground
Simulate running clip commands and inspect the live clipboard buffer in real time.
📋 Simulated Clipboard
16 bytesWhy 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:
date -I | cut -d- -f2 | clip2. Trimming Trailing Newline (-n)
Essential when copying paths, passwords, or authentication tokens into forms or terminal prompts:
pwd | clip -n3. Remote SSH Copying with OSC 52
When logged into remote cloud servers or inside Docker containers without X11 or Wayland:
cat /etc/hostname | clip --osc524. Pasting from Clipboard (-p / --paste)
Extract current clipboard content and pipe to other utilities:
# 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.
| Environment | Condition | Copy Utility | Paste Utility |
|---|---|---|---|
| Wayland | $WAYLAND_DISPLAY set | wl-copy | wl-paste |
| X11 (Primary) | $DISPLAY set & xclip | xclip -in | xclip -out |
| Remote SSH / Headless | --osc52 or SSH session | OSC 52 ANSI escape | N/A (terminal restricted) |
| macOS | pbcopy command found | pbcopy | pbpaste |
| Windows / WSL | clip.exe command found | clip.exe | powershell Get-Clipboard |
Command-Line Reference
Complete flag manual and options reference for clip.
Outputs current clipboard contents to standard output. Cannot be combined with file arguments.
Clears the active system clipboard buffer immediately.
Forces use of OSC 52 terminal ANSI escape sequence to copy data over SSH or inside tmux sessions.
Strips the single trailing newline character (\n) from incoming data before saving to clipboard.
Targets the primary mouse selection buffer instead of the default clipboard buffer (supported on X11, Wayland, and OSC 52).
Displays standard command-line usage summary, supported options, and exits with code 0.
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.
git clone https://github.com/joshuacox/clip.git\ncd clip\nsudo make installMethod 2: Quick Installer
Downloads and executes the bootstrap installer automatically.
curl -sL https://git.io/clipinstall | bashMethod 3: via Nix Flake
Run directly without installing, or install to your user profile.
nix run github:joshuacox/clip -- --help\nnix profile install github:joshuacox/clipMethod 4: via Homebrew (macOS / Linux)
Install using the included Homebrew formula.
brew install joshuacox/clip/clip