Here is the pbcopy command, which copies everything that is transferred to it from the terminal to the clipboard.
echo 'String to copy' | pbcopy
This will copy "String to copy" to your clipboard.
And you can use this to insert this sting into any file.txt file
pbpaste > file.txt
Rahul source share