LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

pbcopy

copies standard input to the macOS clipboard

TLDR

Copy text to clipboard
$ echo "[text]" | pbcopy
copy
Copy file contents
$ pbcopy < [file.txt]
copy
Copy command output
$ ls -la | pbcopy
copy
Paste from clipboard
$ pbpaste
copy
Paste to file
$ pbpaste > [file.txt]
copy

SYNOPSIS

pbcopy [options]pbpaste [options]

DESCRIPTION

pbcopy copies standard input to the macOS clipboard (pasteboard). Its companion pbpaste outputs clipboard contents to standard output.These tools integrate the command line with the graphical clipboard, enabling scripted clipboard operations.

PARAMETERS

-pboard name

Pasteboard name (general, ruler, find, font).
-Prefer type
Preferred data type (txt, rtf, ps).

USAGE EXAMPLES

Copy output and paste elsewhere:

$ cat file.txt | pbcopy
# Cmd+V in any application
copy
Process clipboard contents:
$ pbpaste | grep pattern
copy

CAVEATS

macOS only. Rich text may not copy as expected. Binary data needs careful handling. Pasteboard changes affect system clipboard.

HISTORY

pbcopy and pbpaste are macOS utilities provided by Apple. They have been part of macOS since early versions, providing command-line access to the system pasteboard (clipboard).

SEE ALSO

xclip(1), xsel(1), wl-copy(1)

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid