What Are Linux Commands?
The command line—the place where you type text instead of clicking icons—is one of the most important tools in computing. Servers, development environments, and many IT jobs rely on it. Learning the command line gives you direct control over the system, helps you automate tasks, and is the same on Linux, macOS, and most cloud and server environments. Even if you use a graphical interface day to day, knowing how to use the command line will make you more effective and prepare you for courses and careers in technology.
When you use the terminal in Linux, you type commands to tell the computer what to do. A command is the name of a small program or built-in action, and you can change how it behaves by adding options and arguments. This lesson explains what commands are and how their parts—options and arguments (sometimes called attributes or parameters)—fit together. You will use this structure for every command you learn in later lessons.
Quick Reference
| Term | Description | Example |
|---|---|---|
| Command | The name of the program or action you run | ls, cd, cat |
| Arguments | Inputs or targets you give the command (e.g. file or directory names) | file.txt, /home/user |
| Options (short) | Single-letter flags that change behavior, usually with one hyphen | -l, -a |
| Options (long) | Word-style flags that change behavior, usually with two hyphens | --all, --help |
What Is a Linux Command?
A command is the first word you type in the terminal. It is the name of something the computer knows how to run: either a small program (like ls or grep) or a built-in action (like cd). When you press Enter, the shell looks up that name and runs the matching program or built-in. Everything else you type on the same line—options and arguments—is passed to that command so it knows how to behave and what to act on. In later lessons you will learn specific commands; here we focus on the general shape of any command line.
Why This Matters
Almost every Linux command follows the same pattern: command name, then optional options, then optional arguments. Once you understand that pattern, you can read the manual for any command (man commandname) and know what the listed "options" and "operands" mean. You will also be able to combine commands and use the same ideas in scripts.
The Structure of a Command Line
A typical command line has up to three kinds of parts:
- Command name — The program or built-in you are running (e.g.
ls,cp). - Options — Flags that change how the command runs (e.g. show more detail, include hidden files). Options usually start with
-or--. - Arguments — The things the command acts on: often file names, directory names, or other inputs. In some textbooks or courses these are called parameters or attributes of the command. (The word "attributes" is also used for file properties like permissions; in this lesson we use "arguments" for the items you type after the command.)
Not every command needs options or arguments. Some commands run with just the name; others require at least one argument (for example, a file name). The order often looks like this:
command_name [options] [arguments]
Items in square brackets are optional. In practice, options and arguments can sometimes be mixed, but many commands expect options first, then arguments. When you learn a specific command, the manual page or your course materials will show the correct order.
Arguments (Parameters / Attributes)
Arguments are the extra words you type after the command (and usually after any options). They tell the command what to work on. For a command that lists files, the argument might be a directory name. For a command that reads a file, the argument is usually the file name. For example:
- A command that copies files might take two arguments: the source file and the destination.
- A command that changes into a directory takes one argument: the path to that directory.
- A command that displays a file takes one or more arguments: the file names to display.
If a command requires an argument and you don't give one, it may print an error message, prompt you for input, or use a default (depending on the command). In later lessons you will see exactly which arguments each command expects.
Options: Short Form and Long Form
Options (also called flags) change the behavior of a command. They do not name a file or directory; they turn on or off a feature (e.g. "show hidden files" or "list in long format"). Linux commands usually support two styles: short options and long options.
Short Options
Short options are usually a single letter preceded by a single hyphen -. For example, a list command might use -l for "long format" and -a for "all" (including hidden files). You can often combine several short options after one hyphen:
# One option
command -l
# Two options combined
command -la
# Same as -l -a (on many commands)
command -al
Not every command allows combining options this way; when in doubt, use one option at a time or check the manual.
Long Options
Long options are full words (or several words) preceded by two hyphens --. They are easier to remember and read. For example, --all might do the same thing as -a, and --help might print usage information. Long options are usually not combined on one hyphen; you write each one separately:
# Long form
command --all
# Multiple long options
command --all --long-format
# Mixing short and long (order depends on the command)
command -a --long-format
Many commands support both a short and a long form for the same behavior (e.g. -a and --all). The manual page for a command lists all supported options.
Options That Take a Value
Some options need a value right after them. With short options the value is often right next to the option (e.g. -n 5 or -n5). With long options you often use an equals sign (e.g. --lines=5) or a space (e.g. --lines 5). The exact syntax is given in the command's manual or help.
# Short option with value (two common styles)
command -n 5
command -n5
# Long option with value
command --lines=5
command --lines 5
Putting It Together
A full example might look like this (using placeholder names):
command_name -a --verbose file1.txt file2.txt
Here, command_name is the command, -a and --verbose are options, and file1.txt and file2.txt are arguments. You will see real examples like this for ls, cp, grep, and others in later lessons.
Getting Help for a Command
Later in this chapter you will learn how to get help for a command using the man and help commands.
Tips for Success
- Start with the command name — Always type the command first; then add options and arguments as needed.
- Options modify behavior, arguments are the targets — Options usually start with
-or--; arguments are often file or directory names. - Use the manual —
man commandnamelists all options and how to use arguments for that command. - Long options can be clearer — If you're not sure,
--helpor a long option like--allis often easier to remember than-hor-a. - Spacing matters — Put spaces between the command, each option, and each argument unless the command's documentation says otherwise (e.g.
-n5).
Common Mistakes to Avoid
- Forgetting the hyphen(s) before options —
lis not the same as-l; the shell will treatlas an argument or a different command. - Using a long option with one hyphen —
-allis often wrong; use--allfor the long form. - Assuming every command has the same options — Options are specific to each command; always check the manual or help.
- Putting options after arguments when the command expects options first — Some commands are strict about order; when something doesn't work, check the correct syntax.
Best Practices
- Read the command's help or man page before using unfamiliar options.
- Use meaningful arguments (e.g. correct file and directory names) and check that they exist when the command expects paths.
- Prefer long options in scripts or when you want the command to be easy to read later.
- When in doubt, run the command with
--helporman commandnameto confirm the options and argument order.