If you are working in terminal/console most of your time, you may already know how to copy a file content to clipboard. But if not, here today we will explore how can we copy a file content to clipboard in terminal.
sudo pacman -S xclip
sudo apt install -y xclip
We will add an alias for it to make it easier to use.
Add it to
.zshrc file in terminal.
echo "alias ccopy='xclip -sel clip <'" >> ~/.zshrc
Note: I have used
ccopy as a command, you can use any. Just make sure to not use any of the current ones your system may have.
ccopy alias above, to use it right away without login or restart.
echo "alias ccopy='xclip -sel clip <'" >> ~/.bashrc
Using it is very simple.
footer.php is now available in clipboard.
Let’s copy our system public ssh key to clipboard.