Yos Riady software craftsman 🌱

Handy bash command to copy to clipboard

I learned a nifty bash trick today. Check out the following code:

cat ~/.ssh/id_rsa.pub | pbcopy

The above copies your ssh public key into your clipboard.

Basically, we can pipe the output of any bash command to pbcopy, and have its contents of the previous operations copied directly to our clipboard. To paste the contents of your clipboard:

$ pbpaste

Handy!

Author

Yos is a software craftsman based in Singapore.

📬 Subscribe to my newsletter

Get notified of my latest articles by providing your email below.


Going Serverless book

Interested to find out more about serverless? Going Serverless teaches you how to build scalable applications with the Serverless framework and AWS Lambda. You'll learn how to design, develop, test, deploy, and secure Serverless applications from planning to production.

Learn More →