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
Course pathWalk it in order
Look it upDip in anytime
Go furtherLeaves this page
Don't Panic
Don't Panic — Command-Line Fundamentals
The command line is a text interface for directing a computer. You provide an operation and its inputs, then inspect the result. It is not a mysterious alternate operating system. It is a compact way to make an action precise, repeatable, and usable from a remote session. The symbols can look as though they belong to a private club. They are grammar, which is less glamorous but far more useful.
A terminal hosts the text session. A shell reads the command language inside it. A command performs one operation. These three often arrive together in one window, wearing very similar clothes, which has caused decades of understandable confusion. The first surprise is that the shell does not hand your text straight to a command. It recognizes words and operators, applies quoting and expansion, arranges redirection, finds a command, runs it, and receives a status.
That sequence explains the odd furniture. A space can separate arguments. A wildcard can become filenames. Quotes tell the shell when text must stay literal or remain one value. Redirection connects input or output to a file, while a pipeline connects one command's output to the next command's input. Traditional shells commonly move byte streams; PowerShell commonly moves objects. The vertical bar has not betrayed you. It merely has more than one job description.
Every command also reports an exit status. In Bash and similar shells, zero signals success and a nonzero value signals failure. Output and status are separate, so a quiet command is not automatically correct and a noisy command is not automatically broken. Confirm your location, inspect help, start with a read-only action, narrow the target, then check both the result and the status. That order is not ceremonial; it is how a clever-looking command becomes an accountable one.
The Intro tab gives the full execution model and glossary. Slides compress the relationships into a map. Cheatsheet keeps the terms, stream directions, quoting rules, and inspection loop nearby. Practice turns the model into visible input, output, and status. Start there. Memorizing every utility is a poor bargain when the durable skill is knowing what the shell is about to do.
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
- https://pubs.opengroup.org/onlinepubs/9799919799/utilities/mkdir.html
Supports
- Portable mkdir directory creation semantics and -p behavior used in the practice reference and exercise
- https://pubs.opengroup.org/onlinepubs/9799919799/utilities/printf.html
Supports
- Portable printf format and operand behavior used to create controlled practice output
- https://pubs.opengroup.org/onlinepubs/9799919799/utilities/wc.html
Supports
- Portable wc line and byte counting used to inspect pipeline and redirected input
- https://www.bell-labs.com/usr/dmr/www/retro.pdf
Supports
- UNIX operational in 1971
- interactive shell, redirection, and pipe foundations
- 1978 Bell System Technical Journal reference for Stephen Bourne’s UNIX Shell paper
- https://pubs.opengroup.org/onlinepubs/9699919799/frontmatter/refdocs.html
Supports
- IEEE POSIX.1-1988 reference
- 1997 Commands and Utilities Issue 5 record
- April 2004 Issue 6 Shell and Utilities record
- https://pubs.opengroup.org/onlinepubs/9799919799/xrat/V4_xcu_chap01.html
Supports
- IEEE Std 1003.2-1992 as a base document for the POSIX utility set
- POSIX.1-2024 Shell and Utilities rationale
- https://pubs.opengroup.org/onlinepubs/9699919799/frontmatter/preface.html
Supports
- Issue 7 presentation of POSIX.1-2008 and its Shell and Utilities volume
- https://pubs.opengroup.org/onlinepubs/9799919799.2024edition/frontmatter/preface.html
Supports
- POSIX.1-2024 Issue 8 publication context
- https://devblogs.microsoft.com/powershell/its-a-wrap-windows-powershell-1-0-released/
Supports
- Windows PowerShell 1.0 release announced on November 14, 2006
- https://www.gnu.org/software/bash/
Supports
- GNU Bash project and its sh-compatible shell role
- https://github.com/PowerShell/PowerShell
Supports
- Current open-source PowerShell project
- https://github.com/microsoft/terminal
Supports
- Windows Terminal project, terminal-host role, and MIT licensing
- https://iterm2.com/
Supports
- iTerm2 terminal-host project
- https://wezterm.org/
Supports
- WezTerm terminal-host and multiplexer project
- https://mywiki.wooledge.org/BashProgramming
Supports
- Interpreter declaration, shell selection, parsing, quoting, and word-splitting practitioner guidance
