⚑️ Lighting blaze file content copying to the Clipboard (Mac) πŸ’»

avinashsivaram profile image Avinash Sivaraman ・1 min read

Have you ever tried to copy the content of a file and paste it somewhere else like copying a JSON file and pasting it in some website. When you want to copy a file, we need to open a file and select all the content by command + A (or using the mouse) and copying the content of the file.

Here is the trick to copy the content directly from the terminal.

pbcopy < filename.txt

We can simplify the command by adding an alias in our .bashrc file. So, we don't need to type this whole command to copy the content. Open the .bashrc in vim or any other editor of your choice.

 vim ~/.bashrc

Add the below line inside the .bashrc file and save it.

alias cc='pbcopy <'

Now we need to restart the terminal or run the below command in the terminal to see our alias in action.

source ~/.bashrc

Finally, you can copy the content of the file by using the cc command and this command is local to your machine.

cc demo.txt

Happy Coding πŸ’». You can find my personal .bashrc file which contains a lot of GitHub and npm shortcuts here. I am really happy to discuss more tips and tricks to improve productivity. Feel free to comment down below ⬇️

Posted on Jun 2 by:

avinashsivaram profile

Avinash Sivaraman


I am an agog and friendly person. I love to meet new people and love adventure. I am currently investing my time to play around JS and Web performance. Love to chat on those topics πŸ’œ


markdown guide

It's an useful and an easy read! πŸ‘πŸ‘