Command-Line Fundamentals
Command-line fundamentals covers working in a text terminal: navigating file systems, running programs, combining tools with pipes and redirection, managing processes, and writing simple shell scripts to automate repetitive tasks.
itComputer fundamentals | OpenSkills.info
Intro
Command-Line Fundamentals
A command line lets you direct a computer by entering text. You state an operation, provide inputs, and receive output. That small interface scales from inspecting one folder to controlling remote servers and automated build systems.
The command line is not one program. A terminal provides the text interface. A shell reads your command language. A command performs a task. Keeping those layers separate makes unfamiliar systems easier to understand.
The execution model
In a traditional shell, a command line usually has this shape:
command option argument
The shell first parses your text. It recognizes words and operators, performs expansions, applies redirections, finds the command, and runs it. The command then returns output and an exit status.
That sequence explains many surprises. Spaces separate words unless quoting protects them. Wildcards may expand before the command starts. A redirection is handled by the shell, not passed to the command as an ordinary argument.
Continue the course
This section is part of the paid course.
See pricing to subscribe, or log in if you already have access.
Sources
- https://pubs.opengroup.org/onlinepubs/9799919799/utilities/V3_chap02.html
Supports
- Shell as a command language interpreter
- Shell processing stages including token recognition, parsing, expansion, redirection, command search, execution, and status
- Simple commands, pipelines, quoting, redirection, environment, and exit-status semantics
- POSIX pipeline connection from standard output to standard input
- https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/V1_chap12.html
Supports
- Portable utility option and operand syntax conventions
- Distinction between general conventions and utility-specific interfaces
- https://pubs.opengroup.org/onlinepubs/9799919799.2024edition/utilities/command.html
Supports
- command name resolution inspection with command -v and command -V
- PATH search behavior for standard utilities
- https://pubs.opengroup.org/onlinepubs/9799919799/utilities/pwd.html
Supports
- Current working directory and absolute pathname reporting
- https://pubs.opengroup.org/onlinepubs/9799919799/utilities/cd.html
Supports
- Changing the current shell execution environment's working directory
- Relative and absolute directory operands
- https://www.gnu.org/software/bash/manual/bash.html
Supports
- Terminal, shell, builtin, external command, execution environment, and PATH relationships
- Bash tokenization, quoting, expansion, redirection, command search, and execution order
- Single-quote and double-quote behavior
- Standard streams and file descriptors
- Bash exit status, including zero success and nonzero failure
- Foreground jobs, interrupts, shell scripts, and command environments
- https://www.gnu.org/software/bash/manual/html_node/Pipelines.html
Supports
- Pipeline syntax and standard-output to standard-input connection
- Separation of pipeline data flow from exit-status behavior
- https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_pipelines?view=powershell-7.6
Supports
- PowerShell pipeline composition
- PowerShell passing objects between commands
- Pipeline parameter binding behavior
