Clipboard
Copy to and paste from clipboard. Especially useful for very large files or when you use SSH with no GUI.
See StackOverflow answer for usage and shortcuts.
Linux
Use xclip
- see man page.
xclip [OPTION] [FILE]…
Description
Reads from standard in, or from one or more files, and makes the data available as an X selection for pasting into X applications. Prints current X selection to standard out.
Read
Store value in X selection.
Command output.
$ COMMAND | xclip
Read file.
$ xclip PATH
This lets you paste using the middle mouse button.
If you prefer to traditional pasting:
$ xclip -sel clip PATH
Or according to the manpage:
-selection
specify which X selection to use, options are “primary” to use XA_PRIMARY (default), “secondary” for XA_SECONDARY or “clipboard” for XA_CLIPBOARD
Output
Print.
$ xclip
Pipe.
-o, -out
prints the selection to standard out (generally for piping to a file or program)
$ xclip -o > PATH
macOS
Use pbcopy
and pbpaste
.
Read
Copy file.
$ pbcopy < PATH
Output
Print.
$ pbpaste
Pipe.
$ pbpaste | head