Shell command explainer
Paste a command to see what each flag, pipe and redirection does, and whether it is dangerous.
Last updated
In short: A shell command line is a command name, then options (words starting with - or --), then arguments such as file names, and it may be joined to other commands with |, && or ;. Paste one here and every part is explained in plain language, combined flags like -xzvf are split, and dangerous patterns such as rm -rf /, chmod -R 777 or curl | sh get a clear warning. Nothing you paste leaves your browser.
Your input never leaves your browser. Everything is calculated on your device; nothing you type is sent to a server.
Review generated files before you use them. Provided as-is — see Terms.
How does the Shell command explainer work?
When you press Enter, the shell (usually bash) first cuts the line into words. Quotes keep spaces inside one
word: 'my file.txt' is one argument, my file.txt is two. The first word is the
command. Words that start with - or -- are options
(also called flags) that change what it does, and the rest are arguments, usually file or
folder names. Short options can be written together, so ls -la is the same as ls -l -a.
Some options take a value: in tar -xzf backup.tgz the f takes
backup.tgz as the archive name.
Before the command runs, the shell also rewrites some words. *.log becomes the list of matching
file names, ~ becomes your home folder, $HOME becomes the variable's value, and
$(date +%F) runs date and pastes its output in. That is why an unquoted
* or an empty variable can turn a harmless command into one that touches far more files than
you meant.
Operators join commands. | (a pipe) feeds the output of one command into the next;
&& runs the next command only if the previous one succeeded; || only if it
failed; ; always. Redirections send output to files: > replaces a file's
contents, >> appends, 2> redirects error messages and 2>&1
merges them with normal output. sudo in front runs the command as root, but not the
redirection: sudo echo x > /etc/file still fails, which is why people write
echo x | sudo tee /etc/file.
This explainer parses the line the same way, then looks every command and option up in a hand-written list
of about a hundred common commands, built from their manual pages (the
GNU Bash manual, GNU coreutils, util-linux,
OpenSSH, systemd and podman). Anything not in that list is marked unknown instead of guessed: check it
with man name or name --help. Warnings cover the mistakes that destroy data or open a
system up, such as rm -rf /, chmod -R 777, dd of=/dev/sdX,
mkfs, > on system files and curl | sh. No warning does not mean
safe: always read a command before you run it, especially with sudo.
Worked examples
Unpacking a backup
Input tar -xzvf backup.tar.gz -C /opt gives -x: extracts, -z: gzip, -v: lists each file, -f: the archive file name; -C: changes to /opt first
tar's options are single letters that can be written together. f takes a value, so the word after the cluster (backup.tar.gz) is the archive name. -C /opt unpacks into /opt instead of the current folder.
An install one-liner
Input curl -fsSL https://get.example.com | sudo bash gives Danger: this runs a script from the internet without showing it to you
curl downloads the script and the pipe feeds it straight into bash, running as root because of sudo. You never see what runs. Download it to a file first, read it, then run it.
Cleaning up old logs
Input find /var/log -name '*.gz' -mtime +30 -delete gives Caution: find -delete deletes every match
find walks /var/log, keeps files whose name matches *.gz and that were changed more than 30 days ago, and deletes them. Run it without -delete first to see the list. -delete must stay last: find reads left to right.
Frequently asked questions
What does rm -rf do?
rm deletes files. -r (recursive) also deletes folders with everything inside them, and -f (force) never asks for confirmation and ignores missing files. Together they delete whatever you name without a question and without a recycle bin, which is why rm -rf / or rm -rf ~ destroys the system or your home folder.
What does 2>&1 mean?
Every program has two output streams: normal output (1) and error messages (2). 2>&1 sends the error messages to wherever normal output goes. Order matters: command > log.txt 2>&1 puts both in log.txt, while command 2>&1 > log.txt still shows the errors on screen.
Why is curl | sh dangerous?
The pipe runs whatever the server sends immediately, with your rights (or root's with sudo). You never read it, a hacked or spoofed site can send anything, and a download that breaks off halfway can run a half-written command. Save the script with curl -o install.sh, read it, then run bash install.sh.
What is the difference between > and >>?
> writes the output into a file and empties the file first, so its old contents are gone. >> appends to the end and keeps what was there. A classic mistake is sort names.txt > names.txt: the shell empties names.txt before sort reads it, leaving an empty file.
Does this tool run my command or send it anywhere?
No. The command is parsed and explained by JavaScript in your browser; nothing is run and nothing is sent to a server. Commands and options it does not know are marked as unknown instead of guessed.