← Other topics

Safely run commands you find online

Video Notes

As programmers, we often encounter blog posts, tutorials, forum posts, etc. where strangers on the internet offer us commands to run to solve some problem or accomplish some task.

In our rush to make progress in what we’re working on, it’s tempting to copy/paste and blindly run these commands without really understanding what they’re doing - but that can lead to trouble if the command is doing something you don’t want or expect it to do.

Case in point:

Knowing this, it’s always a good idea to do a little bit of research on any commands you don’t understand before you run them on your computer or server. Below our two resources I like to use for this research...


ExplainShell.com takes any command and breaks it down piece by piece, pulling directly from the command manuals. As an example, plug the following command from my guide on upgrading PHP in and check out the results:

> sudo dpkg -l | awk '/^ii/{print $2}' | grep php | tee php-packages.txt


ExplainShell is great for detailed technical documentation, but if I want a more “plain English” explanation of a command, ChatGPT is my new go-to tool:

Doubling back to the dangerous git command shown in the example above, ChatGPT even provides some words of warning about the command in question, telling us that it’s destructive and should be used with caution.

If this info helped you out you can say thanks and support future content by clicking my Amazon affiliate link: https://amzn.to/3UtgnYk. If you make a purchase on Amazon within 24 hours of clicking the link I may receive a micro-commission and it costs you nothing extra. Any income from these sales goes directly to supporting me in making new videos and guides. Thank you for your support!

← Other topics