Shell commands to paste from the clipboard

Writing out a copy.

The clipboard is an easy way to transfer data into the command line from other tools. Use your system’s “paste from clipboard” command to pipe data into other commands for processing.

(See also my “copy to clipboard” post.)

On macOS, use pbpaste:

$ pbpaste | <command>

On Windows with PowerShell, use Get-Clipboard:

$ Get-Clipboard | <command>

If don’t use PowerShell, you can invoke it to run Get-Clipboard:

$ powershell.exe -noprofile -command Get-Clipboard | <command>

On Linux with Wayland (most distributions), use wl-paste:

$ wl-paste | <command>

On Linux with X11 (typically older distributions), use xclip:

$ xclip -o | <command>

Fin

Paste happy!

—Adam


Newly updated: my book Boost Your Django DX now covers Django 5.0 and Python 3.12.


Subscribe via RSS, Twitter, Mastodon, or email:

One summary email a week, no spam, I pinky promise.

Related posts: