ShellCommand Expert
← Back to the explainer

How to Check a Script You Copied From the Internet

Copy-pasted shell is how most people run code they did not write. That is fine when you verify it — and verification is five minutes of reading, not a specialist skill.

Put it in a file first

Paste the script into a file and open it in an editor. A page that renders a one-line curl | sh has hidden the whole program from you; a file shows every line, including the ones that only run under a condition.

Read the shape before the detail

Skim for structure: how many functions, what the entry point is, whether it loops over input, and whether it needs sudo. A script that asks for root in its first five lines deserves a slower read than one that only touches a temp directory.

Find every place it writes

Search the file for >, rm, mv, dd, chmod, chown, sudo, crontab, systemctl and curl/wget. Each hit is a decision the script is making on your behalf.

Pay particular attention to anything that installs a service, adds a cron entry, or modifies a shell startup file (.bashrc, .zshrc, .profile). Those persist and run again at every login.

Check what it downloads at runtime

A script that downloads and executes further code at runtime is not one program, it is a pipeline whose final stage can change without notice. If the download is unavoidable, at least pin it: fetch the file, inspect it, and run the copy you read.

Run it somewhere disposable

A container or a spare machine is the honest test. If the script does something you did not expect, you find out where the damage is bounded to something you can delete.

Then use the explainer

Once the script is in front of you, paste any single line you are unsure about into the command explainer for a plain-English breakdown of each flag.

Explain a command →
Home All guides About Contact Privacy
© 2026 Shell Command Expert