Most shell commands are safe. The dangerous ones look almost identical to the safe ones. A single extra flag can turn "list what's here" into "delete what's here", and a pipe can turn a read-only command into one that overwrites a file. The gap between the two is usually one character.
-czvf is four flags). Long flags are self-describing but easy to skim past (--exclude, --force).>), -o, -i, --in-place, rm, mv, and dd all change state. > truncates a file before the command even runs.rm -rf — recursive, forced, no confirmation. There is no undo.find … -delete / -exec rm {} + — deletes every match. Test the same find without the action first.sed -i / perl -i — edits files in place. Without a backup suffix, the original is gone.tar -x — extracts; combined with an absolute path it can write outside the current directory.chmod -R 777 — makes a whole tree world-writable. Rarely what you want, always hard to walk back.Take tar -czvf backup.tar.gz --exclude='*.log' ./src:
tar — the archiver.-czvf — create a new archive (c), filter it through gzip (z), be verbose so you can see progress (v), write to the next argument as a file (f).backup.tar.gz — the archive to create. This is the file that gets written.--exclude='*.log' — skip anything matching the pattern../src — the tree to archive.Now you know exactly which file it creates and what it will contain — before running it.
rm -rf, find -delete, sed -i, dd, and the safe alternative for each.curl … | sh and wget -O- … | bash execute whatever the remote server decides to send at that moment. The content can change after you read it. Download it, read it, then run it — or paste it here to get a breakdown of what it does.