cb — Command-Line Clipboard Utility
cb is a fast, lightweight, cross-platform CLI tool written in Go for terminal power users. Pipe command output straight to your system clipboard (command | cb) or print clipboard content back to stdout (cb -p) across Linux, macOS, and Windows.

Features
- Piping Input: Pipe standard output directly into your clipboard (
cat file.txt | cb).
- Pasting Output: Print current clipboard contents back to standard output (
cb -p or cb --paste).
- Cross-Platform: Full support for macOS (
pbcopy/pbpaste), Linux (xclip/xsel/Wayland), and Windows.
- Zero Configuration: Single compiled binary with no external runtime dependencies.
Installation
Option 1: Via go install (Recommended)
If you have Go installed, run:
Bash
go install github.com/dx-zone/cb@latest
Ensure $(go env GOPATH)/bin is in your $PATH.
Option 2: Pre-compiled Binaries
Download the latest pre-compiled binary for macOS (Apple Silicon/Intel), Linux, or Windows from the Releases Page.
Extract the archive and move cb to a directory in your $PATH (e.g., /usr/local/bin):
Bash
tar -xzf cb_*_Darwin_arm64.tar.gz
sudo mv cb /usr/local/bin/
Usage
Copying to Clipboard
Pipe command output directly into cb:
Bash
# Copy text string
echo "Hello, World!" | cb
# Copy SSH public key
cat ~/.ssh/id_ed25519.pub | cb
# Copy current directory path
pwd | cb
Pasting from Clipboard
Use -p or --paste to read contents from the clipboard:
Bash
# Print clipboard contents to terminal
cb -p
# Save clipboard contents into a file
cb --paste > output.txt
# Pipe clipboard contents into another command
cb -p | grep "error"
Development
Clone the repository and use the included Makefile for local testing and builds:
Bash
# Clone repository
git clone https://github.com/dx-zone/cb.git
cd cb
# Run unit tests
make test
# Build binary to bin/cb
make build
# Install locally to GOPATH/bin
make install
License
Distributed under the MIT License. See LICENSE for details.