DEV Community

Discussion on: How to run copied CLI commands with a leading "$" sign

Collapse
 
pcjmfranken profile image
Peter Franken • Edited

Do not copy code straight into your terminal, and especially not from random blogs or embedded content! The website could have very easily loaded something else entirely from what it showed onto your clipboard.

Nasty stuff can and does happen which neither manually copying the snippet nor ZSH will protect you from. Check out this demo thejh.net/misc/website-terminal-co....

At the very least paste it into a plaintext/code editor (which TextEdit.app is not by default) or in your browser's address bar first to check if you're not being had.

If you enjoy gambling, though, and really must paste commands taken off the internet straight into your terminal, don't do so with elevated rights - meaning don't use sudo or enter passwords if you're asked for it until you've inspected the command first.

Collapse
 
stefanjudis profile image
Stefan Judis

Thanks. I'll added a note on top. :)