It depends. Linux, Mac or Windows?
The mac has pbcopy
and pbpaste
to copy and paste something from the clipboard.
Copy example (mac):
echo $PATH | pbcopy
Insert example (mac):
echo "$(pbpaste -Prefer txt)"
Linux uses X, which has several copy-paste buffers (several similar to the clipboard, but slightly more involved).
You can use a small application like XSel to copy / paste. The command will be used in the same form as pbcopy / pbpaste
Copy:
echo $PATH | xsel --clipboard
'paste':
echo "$(xsel --output --clipboard)"
For windows, you can use an application such as clip , which allows you to use the same copy / paste functions
Copy:
set %PATH% | clip
I usually use Linux / Unix, so I donβt have the equivalent to paste from the clipboard on Windows.
source share