There may be times when you want to copy the output of cat command to your clipboard. cat foo.txt | pbcopy
is available on macOS but how do we do something like that on Linux Mint (or Ubuntu)? xclip can be installed to accomplish that.
Install xclip.
sudo apt install xclip
By doing something like the following, you can copy the content of a text file to clipboard.
cat foo.txt | xclip -selection cliboard
This is too much typing just to copy contents from the text file. You could add the following alias in your ~/.bashrc or ~/.zshrc if you use zshell (which is my favorite shell).
alias "cs=xclip -selection clipboard"
Once you add the line, you can do source ~/.bashrc
(or ~/.zshrc
) and you should start to be able to use it like below.
cat foo.txt | cs