Shell Command
A shell command asks the shell to perform an action, often by running a tool with arguments.
Understand the idea
The shell reads a command line and decides what to run. For named commands such as pwd, the name identifies what to run and following words can supply arguments. Some commands are built into the shell; others start separate programs. The detailed syntax depends on the shell, so an example written for one shell is not automatically valid in another.
For a first read-only example in a POSIX-style shell such as Bash or zsh, pwd prints the current working directory. It does not need an argument for this basic use. In PowerShell, Get-Location is the explicit command for showing the current location; PowerShell also supports providers beyond ordinary filesystem folders.
Type only a command you intend to run, then press Enter to execute it. The text that appears afterwards is output. If a tool reports an error, read it before retrying or changing the command. The example path below is illustrative; your own location will usually be different.
Key points
- 01 The shell interprets the command line you enter.
- 02 The named commands in this lesson have a command name and may have arguments.
- 03 A command may be a shell builtin or an external program.
- 04 pwd reports the current directory in a POSIX-style shell.
- 05 Shell-specific examples need the matching shell and available tools.
Worked example
Ask where this shell is working
A worked example using sample data. Nothing here runs on your computer.
pwd/home/learner/human-labExample output only. In a POSIX-style shell, pwd prints your actual current directory. For a PowerShell filesystem session, use Get-Location and expect its own output format.
Visual
flowchart LR C["Command name: pwd"] --> S["Shell runs command"] S --> P["Output: current path"]
Follow the primary sources
An original HWTL explanation, prepared and independently checked with AI against the sources below. This lesson has not yet been tested with human learners.
Source review completed 2026-10-07.
- POSIX.1-2024: Shell Command Language
POSIX shell interpretation, simple command names and arguments, and builtin versus external utility execution.
- POSIX.1-2024: pwd
pwd writes an absolute pathname of the current working directory.
- Microsoft Learn: Get-Location (PowerShell 7.5)
Get-Location reports the current PowerShell location, including provider/drive distinctions.
Practice · predict the result
Keep the command name separate from its output
A small test from your robot instructors. Hints are welcome.
What you will practice: Identify the command name in a small shell example and distinguish its output.
Sample scenario. Synthetic POSIX-style shell with working pwd and a known working directory. No options, arguments, aliases, functions, symbolic links, or shell startup behavior are modeled.
- Host and interpreter
A terminal window is displaying a POSIX-style shell session.- Current folder
/work/lesson-notes- Tutorial command line
$ pwd- Prompt convention
$ is the tutorial's shell prompt marker.
You are working in /work/lesson-notes and enter plain pwd. Which command name and output should this sample produce?
Attempts stay on this browser and are kept separate from lesson views and your self-reported knowledge.
Sources and exercise scope
- POSIX.1-2024: pwd
Plain pwd reports the current working directory as an absolute path, followed by a newline.
- POSIX.1-2024: Shell Command Language
Simple command processing distinguishes a command name and its arguments; execution is performed by the shell.
Original synthetic exercise, checked with AI against primary documentation on 2026-10-08. Human learner validation is pending. A result here records this attempt; it does not establish mastery.
Make this lesson yours
Save it for later, or tell your robot what would help.
This correction stays on this browser. Browse all concepts if the topic is missing.
Familiarity is your own assessment. To use it in your coding tool, download your updated learning profile.
Choices are saved on this browser. They do not sync to your account or coding tool.
Lesson diagnostics
Download the public lesson material, resource choices, and robot text selected for this page. The file does not include your chat, code, or saved profile. Nothing from the trace is uploaded.
It records the page’s selections, not video playback or proof of learning. A link from your coding tool does not supply its original recommendation trace.
Enable JavaScript to create a trace on this device.