Command Structure
Most commands follow the pattern: command, options (flags), and arguments.
Syntax
command [options] [arguments]Almost every Linux command follows the same three-part shape:
command [options] [arguments]The three parts
- Command β the program to run, e.g.
ls. - Options (also called flags) β change how the command behaves. Short options start with one dash (
-l); long options start with two dashes (--all). - Arguments β what the command acts on, such as a file or folder name.
For example, in ls -l /home: the command is ls, the option is -l (long listing), and the argument is /home.
Short options can often be combined: ls -l -a is the same as ls -la.
Example
# command option argument
ls -l /home
# Read the built-in manual for any command
man ls
# Or get a quick summary of the options
ls --helpWhen to use it
- A junior developer reads 'man curl' to learn the correct flag for following HTTP redirects before writing a test script.
- A CI script uses 'ls -la /deploy' with both option and argument to verify file permissions before deployment.
- A sysadmin combines 'tar -czvf' flags into one group to compress a backup archive in a single command.
More examples
Command with option and argument
Shows the three-part anatomy of a Linux command: the verb, modifier flags, and the target path.
# command option(s) argument
ls -lh /var/log
# -l = long format, -h = human-readable sizesGroup multiple short flags
Demonstrates grouping several single-character flags into one argument to keep commands concise.
# Short flags can be grouped after a single dash
tar -czvf backup.tar.gz /etc/nginx
# -c create -z gzip -v verbose -f filenameLong options with values
Contrasts long-form and short-form flag styles, both accepted by standard GNU tools.
# Long options use -- and accept a value after a space
curl --max-time 10 --output page.html https://example.com
# Equivalent short form
curl -m 10 -o page.html https://example.com
Discussion