Read a sample: 1. Why Read Before You Run?
A command can look simple while leaving several important questions unanswered. Suppose a coworker suggests using a command to copy a directory into a shared workspace. Before you press Enter, you need to know more than the command’s name. Does it copy the directory itself or only its contents? What happens if a file with the same name is already there? Does it include subdirectories? Are the paths in the example appropriate for your machine?
Those questions are not signs that you lack skill. They are part of using a system deliberately. Linux gives you many tools that can work quickly and without a long conversation about your intentions. The documentation helps you understand what you are asking a tool to do before you ask it.
This book is about building that reading habit. You do not need to memorize every option on every manual page. You do need a way to find relevant information, interpret it carefully, and recognize when an example does not yet give you enough confidence to run a command.
When you type a command, the computer receives the words and symbols you entered. It does not know the outcome you had in mind unless that outcome is accurately expressed by the command and supported by the tool.
Imagine that your intention is:
> Put a copy of the project notes in the training directory without changing the original notes.
That intention still leaves room for choices. You might want to copy one file or a whole directory. You might want an existing destination file preserved, replaced, or compared first. You might expect the new copy to have a particular name.
A command line must express the relevant choices in a form the program understands. If an option is omitted, the program does not necessarily ask what you meant. It follows its documented behavior for that situation, subject to the actual environment and any errors it encounters.
Consider this illustrative command:
text
cp notes.txt /home/lee/training/
You can read its apparent purpose without running it: it names cp, a source file called notes.txt, and a destination directory. But the line alone does not answer every practical question. Is notes.txt in the current directory? Does the destination exist? Is there already a file with that name there? Which implementation of cp is being used, and what behavior does it document for an existing destination?
The point is not that this particular command is inherently dangerous. The point is that a familiar-looking line can hide assumptions. Reading before running helps you bring those assumptions into view.
Linux manual pages, often called man pages, are a major source of reference information about commands and other system interfaces. A manual page commonly describes a tool’s purpose, the form of its command line, its options, and details of its behavior. Pages differ in organization and depth, so you should expect variation rather than one perfect template.
Documentation can help you answer questions in three broad areas.
Intent: Is this tool meant for the job you have in mind? A search result or a short description can point you toward a candidate, but a promising name is not proof that the command does exactly what you want.
Defaults: What does the tool do when you leave out an option or an operand? Defaults matter because an omitted choice is still a choice from the program’s perspective. You may need to look for a description of the ordinary case, not just a list of optional flags.
Consequences: What can the command read, create, change, or remove? Does it act on a single item or a larger collection? How does it handle an existing destination, an error, or insufficient permission?
A page may also explain how to interpret the command’s output or exit status. An exit status is a value a command returns to indicate an outcome. You do not have to master exit statuses in this chapter; for now, recognize that a command’s visible output is not always the whole story.
Documentation is a source of evidence, not a guarantee that your understanding is complete. A page cannot automatically know which directory you are in, whether you typed the intended path, or what data matters to you. Your task is to connect the documented behavior to the actual situation.
Beginners sometimes treat documentation as something to consult only after a command fails. That approach can work for harmless misunderstandings, but it is a poor habit when a command might change files, affect other users, or produce results that are difficult to interpret.
A better sequence begins with a question:
1. What outcome do I want?
2. Which tool might provide it?
3. What does that tool say it will do with the inputs I intend to give it?
4. What remains uncertain?
Only after those questions are resolved should you decide whether the command is appropriate to run.
This does not mean reading an entire manual page from beginning to end every time. A manual page is a reference, and a focused question makes it easier to use. If you need to know how a command handles an existing file, you can look for that behavior. If you need to know whether an option accepts a value, you can inspect the relevant syntax and option description.
Later chapters will show you how to find pages, move through them, and interpret their notation. At this…