Display contents of file and also copy it to the clipboard
Just paste the clipboard into the terminal window-

cat ~/.ssh/id_rsa.pub | pbcopy; pbpaste


or use tee in the pipe with process substitution

cat ~/.ssh/id_rsa.pub | tee &gt;(pbcopy)


or forget about using pipes altogether

pbcopy &lt;~/.ssh/id_rsa.pub; pbpaste