Shell commands to copy to clipboard

The clipboard is an easy way to transfer data from the command line to other tools. Use your system’s “copy to clipboard” command to store a command’s output for pasting into other applications.
(See also my “paste from clipboard” post.)
On macOS, use pbcopy:
$ <command> | pbcopy
On Windows, use clip:
$ <command> | clip
On Linux with Wayland (most distributions), use wl-copy:
$ <command> | wl-copy
On Linux with X11 (typically older distributions), use xclip:
$ <command> | xclip
😸😸😸 Check out my new book on using GitHub effectively, Boost Your GitHub DX! 😸😸😸
One summary email a week, no spam, I pinky promise.
Related posts: