command-line argument
A word given to a command after its name, such as the file names in cp a.txt b.txt.
In more detail
The shell splits the line into arguments after expansion, and the program receives them as a list. Options such as -r are arguments too; the remaining ones, usually file names, are called operands. A value with spaces must be quoted to stay a single argument.
Related terms
- command-line option — An argument starting with a dash, such as -r or --help, that changes how a command behaves rather than naming what it works on.
- positional parameters — The numbered variables $1, $2 and so on that hold the arguments given to a script or function, with $# holding how many there are.
- word splitting — The step where bash cuts the result of an unquoted expansion into separate words at spaces, tabs and newlines.
- environment variable — A named setting such as PORT=8000 that a program reads from its surroundings when it starts.
- secret — Any value that grants access, such as a password, access token or private key, and must be kept out of code and version control.
- umask — The builtin, and the per-process setting it controls, that lists which permission bits are removed from every new file and directory.
Taught in
- What A Shell Is, And What Bash Is — Bash Scripting & Command Line Automation
- Moving Around: pwd, ls, cd And Paths — Bash Scripting & Command Line Automation
- Making, Copying, Moving And Removing — Bash Scripting & Command Line Automation
- Help, History, Completion And Aliases — Bash Scripting & Command Line Automation
- What Bash Does To A Line Before It Runs It — Bash Scripting & Command Line Automation
- Single Quotes, Double Quotes, Backslash — Bash Scripting & Command Line Automation
- The Unquoted Variable: Splitting And Globbing — Bash Scripting & Command Line Automation
- Arrays, And Why Dollar At Is Not Dollar Star — Bash Scripting & Command Line Automation
- Shell Variables, The Environment And export — Bash Scripting & Command Line Automation
- Arithmetic: Double Parentheses, let And bc — Bash Scripting & Command Line Automation
- Exit Codes, And What Success Means — Bash Scripting & Command Line Automation
- Conditionals: test, Brackets, Double Brackets, case — Bash Scripting & Command Line Automation
- Script Input And Output: read, Heredocs, printf — Bash Scripting & Command Line Automation
- Functions, local And declare — Bash Scripting & Command Line Automation
- Arguments: Dollar One, Dollar At, shift — Bash Scripting & Command Line Automation
- Option Parsing With getopts — Bash Scripting & Command Line Automation
- trap, Cleanup And Temporary Files — Bash Scripting & Command Line Automation
- Debugging: set -x, bash -n And Reading The Error — Bash Scripting & Command Line Automation
- ShellCheck — Bash Scripting & Command Line Automation
- Style That Prevents Bugs — Bash Scripting & Command Line Automation
- eval, And What To Use Instead — Bash Scripting & Command Line Automation
- Permissions And Ownership — Bash Scripting & Command Line Automation
- find And xargs — Bash Scripting & Command Line Automation
- Securing Pipelines: Secrets Management — Continuous Integration & Continuous Delivery Pipelines
- Privileged Access: sudo Rules In Drop-In Files — Red Hat Certified System Administrator (EX200) Exam Prep
- Exam-Style Scripts: Arguments, Output And Exit Codes — Red Hat Certified System Administrator (EX200) Exam Prep
- Repositories You Configure By File — Red Hat Certified System Administrator (EX200) Exam Prep
- Targets, Boot And Shutdown — Red Hat Certified System Administrator (EX200) Exam Prep
- Recovering Root And Changing The Boot Loader — Red Hat Certified System Administrator (EX200) Exam Prep
- Tuning Profiles With tuned — Red Hat Certified System Administrator (EX200) Exam Prep
- GPT Partitions With parted — Red Hat Certified System Administrator (EX200) Exam Prep
- SELinux Modes, And Why setenforce Is Not Enough — Red Hat Certified System Administrator (EX200) Exam Prep
- Four Minutes To Boot: Firmware, GRUB, Kernel And Targets — CompTIA Linux+ (XK0-006) Exam Prep
- Works On My Laptop: Images, Containers, Volumes And Networks — CompTIA Linux+ (XK0-006) Exam Prep
- The Pager Command That Opened A Root Shell: sudo, su And Least Privilege — CompTIA Linux+ (XK0-006) Exam Prep
- The Cleanup That Emptied The Wrong Directory: Shell Scripts Under Exam Conditions — CompTIA Linux+ (XK0-006) Exam Prep
- Forty Servers By Teatime: Ansible Playbooks, Inventories And Puppet Manifests — CompTIA Linux+ (XK0-006) Exam Prep
- The Assistant Was Confident: Reviewing AI-Generated Code, Prompts And Data — CompTIA Linux+ (XK0-006) Exam Prep
- You Are In Emergency Mode: Boot Failures From GRUB To fstab, On Both Families — CompTIA Linux+ (XK0-006) Exam Prep
- Disk Layout And The Boot Loader — LPIC-1 Linux Administrator (101-500 and 102-500) Exam Prep