A minimal command-line tool that reads a file and copies its contents to the clipboard. Written in Zig.
- Reads any file and copies its full contents to the system clipboard
- Cross-platform clipboard support:
- macOS —
pbcopy - Linux —
wl-copy(Wayland) orxclip(X11)
- macOS —
- Zig >= 0.15.2
- A supported clipboard tool on Linux (
wl-copyorxclip)
zig buildFor an optimized release build:
zig build -Doptimize=ReleaseFastThe binary will be at zig-out/bin/ccat.
ccat <file_path>Examples:
# Copy the contents of a file to the clipboard
ccat README.md
# Then paste it anywhere with Ctrl+V / Cmd+V- Opens the specified file and reads its contents into memory.
- Spawns the platform-appropriate clipboard command (
pbcopy,wl-copy, orxclip). - Pipes the file contents to the clipboard command's stdin.
- Prints
Copiedon success.