When a line fails, the reply is an error message. Read it from left to right.
catwho complained: note.txtthe argument it was using: No such file or directorywhat went wrong
The first word: who complained
The first word tells you which program wrote the error:
wcc -l servers.txt
Enter
Shellno program wcc
bash: wcc: command not found
cat note.txt
Enter
Shellstarts cat
catno file note.txt
cat: note.txt: No such file …
bash:The shell could not start the program. No program ran.- The name of a program, such as
cat:orwc:. The program started, then it found a problem with your arguments.
Three common errors
| Error | Who | What went wrong | What to do |
|---|---|---|---|
bash: wcc: command not found | The shell | No program has the name wcc | Correct the command name. Use Tab. |
wc: invalid option -- 'z' | wc | wc has no flag -z | Correct the flag. The next lesson shows how to find the flags. |
cat: note.txt: No such file or directory | cat | There is no file with the name note.txt | Correct the file name. Use quotes if it has a space. |
The words No such file or directory are the exact words that Linux programs use for "this name does not exist".
Read the middle part
When the error has three parts, the middle part names the argument that failed. Compare it with what you wanted to type.