copy content of file to clipboard linux code example
Example 1: bash copy contents of file to clipboard
# Basic syntax using pbcopy:
pbcopy < /path/to/file
# Paste with:
pbpaste > /path/to/output_file
# Note, you can filter what you paste with grep, e.g.:
pbpaste | grep 'useful text' > /path/to/output_file
Example 2: copy content file from terminal
pbcopy < ~/.ssh/id_rsa.pub