linux cat copy to clipboard code example
Example: copy cat command output to clipboard
# This can either be done with xclip or an npm package called clipboard-cli
# With xclip, you would need to sudo install xclip, then use it as so
cat file.txt | xclip
# To paste using sclip
xclip -o
# With the clipboard-cli npm package
# first install globally
npm install --global clipboard-cli
# Then it can be used as follows
cat file.txt | clipboard-cli
# To paste
clipboard