What Is the Command Line?
Read a Command Before You Run It
A command on the
Start with one that runs a program file:
python report.py
The first word, python, is the command name. It tells the report.py is an argument: a target or value handed to that command.
Arguments are not always files. Depending on the command, an argument might be a directory, a new name, a search term, or a number. Position often carries meaning too, and each command decides for itself what goes where. cp a b copies a to b, not the other way round, and nothing in the syntax tells you that.
Options change behavior
An option asks a command to behave differently. -l and long ones like --all. PowerShell uses named parameters like -Path and -Destination.
Read these two without running them:
Bash or zsh: cp "project notes.txt" archive/
PowerShell: Copy-Item -Path "project notes.txt" -Destination archive
In the first: cp is the name, project notes.txt is the source, archive/ is the destination. Position does all the work, and you have to know the order.
In the second: Copy-Item is the name, and -Path and -Destination are named parameters whose values follow them. Longer, and much harder to get backwards.
Both express the same intention in different languages. Do not mix pieces from them. A Bash option is not a PowerShell parameter, and a PowerShell command name means nothing to zsh.
Quotes keep one argument together
Most shells split a command line at spaces. So project notes.txt arrives as two arguments, project and notes.txt, and the command goes looking for a file called project. Quotes hold it together:
python "weekly report.py"
The quotes are instructions to the shell about where the argument boundaries are. They are removed before the program sees anything, and they are never part of the filename. Both single and double quotes exist in the shells you will meet later, and they differ in ways that matter once variables get involved. For now: use the style your track shows, and always close what you open.
In python "weekly report.py", what does the quoted text do?
The error tells you which part broke
The shape of the failure usually points straight at one part of the line:
Command not found means look at the first word. Misspelled, not installed, or not available in this shell.
A program starts, then cannot find a file means look at the argument and at where you are standing.
Unknown option or parameter means check that option against help for this exact command in this exact shell.
A continuation prompt after you press Enter means the shell is waiting for an unfinished part of the command. In these examples, check for an opening quote without its closing quote. Its exact appearance varies by shell. Press
Ctrl+Cand retype the complete line.
That last one catches everybody once. The shell is not frozen; it is politely waiting for the rest of a string you started.
You type pyhton report.py, and the shell reports that pyhton is not a recognized command. Which part should you inspect first?
You press Enter after typing an opening quote but no closing quote. Instead of running the command, your shell shows its continuation prompt. What has happened?
Before you copy a command from anywhere, do four things: remove the prompt, identify the command name, work out what every argument targets, and look up any option you do not recognize. If you cannot say which files or directories it might change, do not run it.
Next: choosing which shell you will actually practice in, and setting up somewhere that mistakes cannot hurt.