Track the current directory, file creation, copying and removal in an isolated virtual filesystem.
The focus of this experiment is to resolve absolute and relative filesystem paths and interpret directory permissions. Students then trace navigation, listing and file operations from a known working directory, and diagnose missing files or access failures using terminal evidence. The Concepts view explains the operation before the practical work; the Simulation view is used to examine reference and changed inputs, not to substitute for actual measurements.
Learning objectives
Resolve absolute and relative filesystem paths and interpret directory permissions.
Trace navigation, listing and file operations from a known working directory.
Diagnose missing files or access failures using terminal evidence.
Identify the configured inputs (Command sequence; Practice filename; Practice directory exists) and record the corresponding observed outputs with units where applicable.
Compare the reference calculation or decision with an independent implementation or authorized observation; state any discrepancy and the applicable model boundary.
Expected learning outcomes
On completion, students can resolve absolute and relative filesystem paths and interpret directory permissions, trace navigation, listing and file operations from a known working directory, and diagnose missing files or access failures using terminal evidence.
Required deliverables
Submit the derivation or state trace for the named operation, the exact reference and changed configurations, the associated simulator or practical evidence, and a short validation statement addressing diagnose missing files or access failures using terminal evidence. Separate predicted values from observations.
Prerequisite knowledge and related learning
Review the following catalogue prerequisites before starting. After completion, continue to Lab 4 · Remote access & Python environments.
The named Linux/WSL or Python environment and its browser teaching representation; use the setup instructions and actual command output for validation.
Begin with a manual prediction, record the baseline, change one independent condition at a time, and compare the resulting trace or measurements with the original prediction. Record observations and uncertainty separately from reference values. Follow the experiment’s specific procedure, safety limits, and acceptance checks.
R3 / PREPARE
Before starting
Follow the setup guide and use the named terminal or editor. A browser model is not a real GPIO measurement or a running service.
Run commands in the named practice folder; confirm pwd before any file operation. Do not remove unrelated files.
CONCEPTS / ACTIVE RECALL
Understand the experiment
Scientific architecture · Linux directory and file operations
Scientific concept map: Shell working directory — pwd; Create directory — mkdir / cd; Create file — touch / redirect; Copy or rename — cp / mv; Inspect result — ls / cat.
Scientific foundations and analytical reasoning
Paths identify filesystem objects; relative paths resolve against the current directory. Copying a file creates a distinct directory entry, while changing directories does not copy anything.
Before operating the equipment or executing the program, derive the expected outcome using the required theoretical work in Experiment. Use the diagram to identify the variables and system boundaries.
Scientific theory · Files, paths and process context
Linux resolves a relative path against the current working directory; an absolute path begins at the root. A directory contains names referencing filesystem objects. Reading, writing, moving and copying have distinct effects; permissions determine whether an operation is allowed. Shell expansion happens before most commands receive their arguments, so quote paths with spaces.
Worked example and engineering interpretation
From /home/student/lab, data.csv and ./data.csv denote the same relative location; ../data.csv resolves to /home/student/data.csv. Predict pwd after cd .., then use ls to verify. Perform destructive operations only on a disposable lab directory.
Engineering principles · additional worked teaching example
A relative path is resolved from the current working directory; an absolute path begins at /. Given /home/student/lab and file a.txt, ../backup/a.txt points to /home/student/backup/a.txt. cp preserves the source; mv changes its path; use pwd and ls to verify each transition.
From theory to experiment
Predict the reference result before operating the workbench; check the actual intermediate state, units and constraints. The existing simulation, implementation and procedure below are distinct sources of evidence.
How to investigate Lab 3 · Linux command line
Navigate a disposable practice directory and verify file operations.
Analytical investigation means collecting an observation, identifying the mechanism, using a calculation or state trace to explain it, and checking your conclusion against evidence. Controlled comparison means changing one independent variable, holding the remaining relevant conditions constant, and measuring a dependent variable against a baseline. Experimental validation means comparing a predicted result to a reproducible observation or assertion; agreement inside a model does not certify hardware. Evidence-based reasoning connects a specific observation to a theoretical rule and states uncertainty, not merely an opinion. Performance characterization records a named metric and its units across conditions; sensitivity analysis changes one parameter across several values. A threat assessment links an asset, threat, consequence and evidence to a mitigation.
Experiment-specific guided practice
Objective: Navigate a disposable practice directory and verify file operations.
Begin at /home/student/practice; create and copy reading.txt. Inspect the two directory entries.
Choose the remove sequence and observe the empty directory.
Select cp missing file; distinguish a failed command from a file created successfully.
Perform the corresponding commands only inside your own disposable practice directory; check pwd and ls after each action.
Reference check:
Model boundary:
Independent task and submission evidence
2. Choose the remove sequence and observe the empty directory. Record the named input, prediction, actual output and one limitation; restore the original condition and repeat.
Before execution write the independent variable and its levels, dependent observation with units where applicable, baseline, controlled variables, measurement method and expected result. For a state machine use state/event/output rather than inventing a numeric metric. Record failures and repeat the baseline. A weak conclusion is “it works”; a supported conclusion names the changed setting, observed value/state, corresponding rule and one limitation.
Trial
Changed setting
Fixed settings
Predicted result
Actual observation / units
Evidence / uncertainty
A: baseline
Reference
Record
Predict
Record
Record
B: one change
Record
Same as A
Predict
Record
Record
A: repeat
Restore
Same as A
Predict
Record
Record
Completion: submit the filled table, relevant simulator screenshot or terminal/notebook output, reasoning with units/assumptions, and one limitation. Preserve the independent assessment questions; this guide does not fill their answers.
Worked engineering reasoning and boundary conditions
Engineering reference configuration: Command sequence = mkdir; touch; cp; Practice filename = reading.txt; Practice directory exists = true. In the classroom model, Files present = 2; Exit status = 0. No actual filesystem is changed. A closed, deterministic browser model. The existing practical instructions and source files provide independent execution; browser results are not hardware measurements.
Use the diagram to follow the calculation or state progression. Keep the teaching configuration separate from the independent exercise values; compare observations with the actual model and implementation.
Concept animation · independent state notebook
Explore the teaching example independently of the simulator. Each step reveals an operation, data relationship or calculated state. The Simulation view has separate editable inputs.
Step 1 of 5 · Calculated state 1
Calculated state 1
Event / item
Initial directory
Observed result
/home/student/practice
Calculated state 2
Event / item
Commands
Observed result
mkdir; touch; cp
Calculated state 3
Event / item
pwd
Observed result
/home/student/practice
Calculated state 4
Event / item
ls
Observed result
reading.txt, reading.txt.copy
Calculated state 5
Event / item
Exit status
Observed result
0
Teaching example only; inspect live calculations or real practical evidence separately.
Recall the concept before revealing its explanation.
0 / 3 revealed
R3 · 01 / 08Why use a practice directory?Reveal explanation
Engineering explanation
It separates disposable exercises from your home files.
R3 · 02 / 08What does pwd show?Reveal explanation
Engineering explanation
The current working directory, which determines relative file paths.
R3 · 03 / 08Why must pwd identify the practice directory before changing files?Reveal explanation
Engineering explanation
Run commands in the named practice folder; confirm pwd before any file operation. Do not remove unrelated files.
R3 · 04 / 08How can you verify a file move rather than infer success from no error?Reveal explanation
Engineering reasoning
List the destination and source directories; the moved filename should appear only at the destination.
R3 · 05 / 08Why use a disposable practice directory?Reveal explanation
Engineering reasoning
It limits changes to files created for the lab and avoids accidentally modifying unrelated user data.
R3 · 06 / 08A script is missing after changing directories. Select every technically valid statement.
A. Use pwd to locate the current directory.
B. Use ls to verify the filename before running it.
C. The working directory is irrelevant to relative paths.
D. An absolute path changes when cd is executed.Reveal explanation
Applied scenario
Correct: A. Use pwd to locate the current directory.; B. Use ls to verify the filename before running it.
R3 · 07 / 08In Linux command line, which command or code executes Inspect Windows and Linux files?Reveal explanation
Implementation recall
ls /mnt/c/Users
explorer.exe .
R3 · 08 / 08For Linux command line, which actual output or state confirms the prescribed practical run succeeded, and what does it not establish?Reveal explanation
Evidence & acceptance
Use the Linux home folder, not Windows System32. mkdir -p is repeatable; touch does not clear existing content. chmod u+x changes only the owner execute bit; ls -l must show it. tree must be installed by the toolkit. explorer.exe . is WSL-specific and not required on a Linux-only host.
Start here · Terminal skills
Linux & WSL Command Center
Learn navigation, file operations, Python execution, services and Windows WSL management. Includes an interactive practice terminal and Dr. Mohammad command explanations.
Execution boundary · Real on WSL. Browser simulation below is a teaching model, not execution of Python or firmware. The real commands run in VS Code/WSL; Wokwi is used for Arduino/ESP32 where indicated.
Shared research workbenches · network designer & advanced studiesConcurrent-device simulation & Monte Carlo research
Distributed digital twin · topology, protocol & battery researchLoading experiment-specific apparatus…Previous model / additional reference tools
Simulation task
Navigate a disposable practice directory and verify file operations.
Explore the model using its own controls. Record a prediction before changing a condition. Compare the reference with a changed condition, then use the Experiment tab for the procedure, acceptance criteria and notebook. Model outputs and physical observations must remain separate.
Interactive engineering workbenchR3 · Existing model
Original virtual instrument; model signals and execution trace.
Loading instrument…
Awaiting model display.
Experimental instrumentation · A/B
Compare two model conditions
Capture a baseline, change one experimental condition, run the model if required and capture the comparison. Snapshots contain visible controls and display text, not physical sensor readings. Review before exporting.
Ask Dr. Mohammad locally, or prepare an experiment-aware prompt for ChatGPT, Gemini or Claude. The external providers open in their own tabs; nothing is automatically submitted.
Public course objective, displayed commands, source excerpts and procedure. Private assessment content is not collected.
Prepare a contextual AI prompt
0 characters
Common secret and email patterns are redacted on preparation; this is not a comprehensive privacy filter. Review the entire editable prompt, including student work and unpublished research, before sharing. The providers apply their own accounts, privacy settings and limits.
Prepare → review → copy & open your selected provider → paste and submit there.
Run & verify — acceptance checklist
Build verification: Directory/file/permission operations executed on Linux.
Use the Linux home folder, not Windows System32. mkdir -p is repeatable; touch does not clear existing content. chmod u+x changes only the owner execute bit; ls -l must show it. tree must be installed by the toolkit. explorer.exe . is WSL-specific and not required on a Linux-only host.
Record the actual output, source (mock/model or physical), and any error. A missing tool, timeout or untested external service is not a pass.
Before the simulation or practical, solve both experiment-specific tasks. List the given inputs, show the intermediate calculation or state trace, identify the expected observation, and state a limitation. Show formulas and intermediate calculations where relevant, or draw the requested state/sequence diagram. These are independent classroom fixtures; where they differ from the reference configuration below, do not treat them as measured values. Compare your predictions with the corresponding experiment afterwards.
01 · Predict and derive using the given inputs
Starting at /home/student, trace mkdir practice, cd practice, touch reading.txt, cp reading.txt copy.txt, cd .. . Draw the resulting tree and current path.
Engineering method — A relative path is resolved from the current working directory; an absolute path begins at /. Given /home/student/lab and file a.txt, ../backup/a.txt points to /home/student/backup/a.txt. cp preserves the source; mv changes its path; use pwd and ls to verify each transition. Apply this method to the assigned values independently; compare your reasoning with the relevant simulator or practical implementation.
02 · Compare or justify using evidence
Predict the effect of running cp reading.txt copy.txt from /home/student instead; explain how pwd and ls can verify your reasoning.
Engineering method — A relative path is resolved from the current working directory; an absolute path begins at /. Given /home/student/lab and file a.txt, ../backup/a.txt points to /home/student/backup/a.txt. cp preserves the source; mv changes its path; use pwd and ls to verify each transition. Apply this method to the assigned values independently; compare your reasoning with the relevant simulator or practical implementation.
03 · Command tracing
Command tracing · Independent work
Inside an empty disposable ~/trial, run mkdir a b; touch a/t.txt; cp a/t.txt b/u.txt; mv a/t.txt a/v.txt. Draw the final tree and identify which paths no longer exist.
Command tracing — A relative path is resolved from the current working directory; an absolute path begins at /. Given /home/student/lab and file a.txt, ../backup/a.txt points to /home/student/backup/a.txt. cp preserves the source; mv changes its path; use pwd and ls to verify each transition. Apply this method to the assigned values independently; compare your reasoning with the relevant simulator or practical implementation.
Work is saved locally when browser storage is available. Export it for submission; no remote upload or automatic grade is assigned.
Expanded independent theoretical exercise bank
Progress from calculation and interpretation to diagnosis and controlled engineering design. Complete the questions without opening the simulation first; show intermediate steps.
Intermediate · Explain a changed-input result
Independent theoretical exercise · R3-01
Use the reference configuration (Command sequence = mkdir; touch; cp; Practice filename = reading.txt; Practice directory exists = true), but change Command sequence = cd ... The model reports Files present = 0. Explain the governing rule and assumptions that make this output plausible; identify an independent verification method.
Intermediate · Quantitative comparison
Independent theoretical exercise · R3-02
Two model observations of Files present are 2 (reference) and 0 (changed condition). Compute signed change and, when the reference is nonzero, percentage change. Explain why units matter.
Intermediate · Interpret a technical trace
Independent theoretical exercise · R3-03
For Command sequence = mkdir; touch; rm, the model supplies this excerpt from Execution observations:
Event / item · Observed result
Initial directory · /home/student/practice
Commands · mkdir; touch; rm
pwd · /home/student/practice
ls · (empty)
Exit status · 0
Count rows whose Observed result value is exactly “/home/student/practice”, and identify the displayed row numbers. Explain what the count describes.
Advanced · Reverse reasoning
Independent theoretical exercise · R3-04
An observation is Files present = 0. Candidate A uses Command sequence = mkdir; touch; cp; Practice filename = reading.txt; Practice directory exists = true. Candidate B changes the listed settings (Command sequence = mkdir; touch; rm) and keeps the remaining settings fixed. Which is consistent with the observation? If both can explain it, say what additional evidence is required.
Advanced · Diagnose a reported mismatch
Independent theoretical exercise · R3-05
A student configures Command sequence = cp missing file while preserving all other reference settings, but copies the reference report of Files present = 2. Evaluate whether the report is justified. Identify the first configuration/output check to perform.
Challenging · Design a controlled verification
Independent theoretical exercise · R3-06
Design a controlled comparison for Lab 3 · Linux command line using reference Command sequence = mkdir; touch; cp; Practice filename = reading.txt; Practice directory exists = true and test Command sequence = cd ... Specify the changed setting(s), measured metric Files present, controls, repetitions, an acceptance check and what evidence can distinguish an actual implementation from the model.
Step-by-step experimental procedure
Track the current directory, file creation, copying and removal in an isolated virtual filesystem.
1 · Reference workbench configuration
Use the named reference workbench and its reference inputs. Additional live instruments may have different controls; use the matching instrument. Record virtual and practical results separately.
Command sequencemkdir; touch; cp
Practice filenamereading.txt
Practice directory existsYes
2 · Perform the investigation in order
Begin at /home/student/practice; create and copy reading.txt. Inspect the two directory entries.
Choose the remove sequence and observe the empty directory.
Select cp missing file; distinguish a failed command from a file created successfully.
Perform the corresponding commands only inside your own disposable practice directory; check pwd and ls after each action.
3 · Compare controlled trials
Trial
Independent change
Expected check
Observation
Copy a file
Use reference inputs above
Files present: 2
Record actual result
Remove a file
Command sequence = mkdir; touch; rm
Files present: 0
Record actual result
Missing source
Command sequence = cp missing file
Exit status: 1
Record actual result
4 · Analyze and report
Explain relative paths and why a missing source returns an error.
Required evidence: Record the named metrics and trace for the reference and changed cases, then attach the corresponding practical command output or device evidence if available.
Model boundary: A closed, deterministic browser model. The existing practical instructions and source files provide independent execution; browser results are not hardware measurements.
Controlled investigation · reproducible evidence
Method. Use the existing reference workbench configuration and the named controlled changes below. A controlled variable stays fixed while the independent variable is intentionally changed; the dependent variable is the resulting observed output. First predict each trial from the Concepts page. Run the baseline, then change only the specified setting and record the outcome. For deterministic traces one execution per case and a repeated verification are sufficient; for timing or stochastic measurements repeat at least five times, recording each run, median and range. Reset to the reference state between independent comparisons.
Trial
Independent change
Dependent observation
Copy a file
Use reference inputs above
Record actual outcome and units
Remove a file
Command sequence = mkdir; touch; rm
Record actual outcome and units
Missing source
Command sequence = cp missing file
Record actual outcome and units
Evidence: attach the completed comparison table, one trace or screenshot per condition, and actual practical terminal/hardware evidence where applicable. Explain any prediction mismatch and distinguish modeled behavior from measured results.
Run commands in the named practice folder; confirm pwd before any file operation. Do not remove unrelated files.
Complete one-time setup first. Copy one command block at a time into the indicated environment. Do not copy prompt characters. Open new terminals where named; variables are terminal-specific. Ctrl+C stops a running foreground command.
01
Create a safe practice directory
All commands operate inside a new folder in your home directory.
WSL · Bash
mkdir-p ~/linux-practice/Documents
cd ~/linux-practice
pwdls-lacd Documents
touch test.txt
ls-l test.txt
chmod u+x test.txt
ls-l test.txt
cd ..
tree -L2 .
✓ Expected: An indented directory tree.Expected result for each action (11)
mkdir-p ~/linux-practice/DocumentsNormally silent. The requested directory exists afterward; verify with ls -d.
cd ~/linux-practiceNormally no output. pwd should show the requested directory. A missing path produces an error; do not continue until corrected.
pwdAn absolute Linux path appears, matching the directory selected in the preceding step.
ls-laThe requested files/directories are listed; compare names and permissions with the guide. An empty directory can produce no output.
cd DocumentsNormally no output. pwd should show the requested directory. A missing path produces an error; do not continue until corrected.
touch test.txtls -l test.txt shows the file.
ls-l test.txtThe requested files/directories are listed; compare names and permissions with the guide. An empty directory can produce no output.
chmod u+x test.txtNormally silent. Verify with ls -l or stat; a private directory should be 700 and a private credential file 600 where specified.
ls-l test.txtThe requested files/directories are listed; compare names and permissions with the guide. An empty directory can produce no output.
cd ..Normally no output. pwd should show the requested directory. A missing path produces an error; do not continue until corrected.
tree -L2 .An indented directory tree.
Checkpoint test.txt gains user execute permission.
02
Inspect Windows and Linux files
These commands only list files or open Explorer.
WSL · Bash
ls /mnt/c/Users
explorer.exe .
✓ Expected: Windows File Explorer opens the current Linux folder; no terminal output is normally required.Expected result for each action (2)
ls /mnt/c/UsersThe requested files/directories are listed; compare names and permissions with the guide. An empty directory can produce no output.
explorer.exe .Windows File Explorer opens the current Linux folder; no terminal output is normally required.
Checkpoint Explorer opens your Linux directory. Keep active Python projects under the Linux home directory.
Experimental notebook
Record your own results. Values are not prefilled or independently verified.
03 / Inspect
Source code and method
Use the inline source or commands in the steps above. No separate source file is required for this foundational lab.
04 / Verify
Evidence of completion
Save the actual terminal output from the checkpoints above. For simulated inputs explicitly record browser model, fakepi, mock or Wokwi. Never present those data as physical measurements. If a checkpoint fails, see the troubleshooting guide.
Download this notebook and open Google Colab. Select File → Upload notebook and choose the downloaded .ipynb.
Read the Markdown instructions before each executable cell. Use a Python runtime, run cells from top to bottom, and resolve imports if necessary.
Perform the baseline and controlled changes. Save the notebook with actual outputs and your written interpretation.
Execution scope: Default computational cells passed isolated local Python execution; physical equipment and live services require separate verification.
01Instructions · Markdown
# R3 · Lab 3 · Linux command line
**PSUT IoT Engineering Studio — Dr. Mohammad Alja’afreh**
## 1. Scientific objective
Track the current directory, file creation, copying and removal in an isolated virtual filesystem.
Complete the analytical worksheet in the portal first. Record your predictions before running this notebook. This notebook is a bounded local computational investigation; use the portal’s separate WSL, hardware or Remix procedure for real interfaces.
02Instructions · Markdown
## Experiment-specific preparation
Navigate a disposable practice directory and verify file operations.
**Reference procedure (use the matching simulator/WSL tool where named, not an unrelated service):**
1. Begin at /home/student/practice; create and copy reading.txt. Inspect the two directory entries.
2. Choose the remove sequence and observe the empty directory.
3. Select cp missing file; distinguish a failed command from a file created successfully.
4. Perform the corresponding commands only inside your own disposable practice directory; check pwd and ls after each action.
**Evidence:**
**Boundary:**
03Instructions · Markdown
## 2. Reference configuration and investigation
1. Begin at /home/student/practice; create and copy reading.txt. Inspect the two directory entries.
2. Choose the remove sequence and observe the empty directory.
3. Select cp missing file; distinguish a failed command from a file created successfully.
4. Perform the corresponding commands only inside your own disposable practice directory; check pwd and ls after each action.
Run cells in order; do not substitute model results for physical measurements.
04Instructions · Markdown
## 3. Create a disposable sandbox and inspect paths.
05Python · executable cell
PYTHON · Code cell
# =====================================================================
# R3 | Code cell 01 | Lab 3 · Linux command line
# Purpose: 3. Create a disposable sandbox and inspect paths.
# Inputs: the explicit fixture/settings below and any preceding cell state.
# Output: inspect printed values, returned records or assertions; record evidence.
# =====================================================================
from pathlib import Path
import tempfile, shutil
# Set workspace for the next computation or reference condition.
workspace=tempfile.TemporaryDirectory()
# Set p for the next computation or reference condition.
p=Path(workspace.name)
(p/"reading.txt").write_text("temperature=25\n")
print([x.name for x in p.iterdir()])
## 4. Copy, inspect and remove only the exercise-owned files.
07Python · executable cell
PYTHON · Code cell
# =====================================================================
# R3 | Code cell 02 | Lab 3 · Linux command line
# Purpose: 4. Copy, inspect and remove only the exercise-owned files.
# Inputs: the explicit fixture/settings below and any preceding cell state.
# Output: inspect printed values, returned records or assertions; record evidence.
# =====================================================================
shutil.copyfile(p/"reading.txt",p/"copy.txt")
# Check the expected invariant so a mismatch fails visibly instead of appearing successful.
assert (p/"copy.txt").read_text()==(p/"reading.txt").read_text()
# Repeat the same operation for each configured input so observations are comparable.
for name in ("reading.txt","copy.txt"):(p/name).unlink()
# Check the expected invariant so a mismatch fails visibly instead of appearing successful.
assert not list(p.iterdir())
workspace.cleanup()
## Experimental analysis and submission
1. Record the reference input, predicted output and actual result.
2. Modify one independent variable and run the relevant cells again.
3. Explain the result using the theory and identify model limitations.
4. Save the notebook with outputs and retain the separate theoretical worksheet.
**Your derivation and conclusion:**
(Complete independently.)
09Instructions · Markdown
## Guided reasoning and evidence
A controlled comparison changes one independent input while keeping the other relevant inputs fixed; the dependent variable is the recorded output. Use this lab’s reference condition above.
**Independent task:** 2. Choose the remove sequence and observe the empty directory. Record the named input, prediction, actual output and one limitation; restore the original condition and repeat.
| Trial | Input/configuration | Prediction | Observation | Evidence / limitation |
|---|---|---|---|---|
| A | Reference | | | |
| B | Changed input | | | |
| A repeat | Reference | | | |
A conclusion is supported only when it cites the recorded values or observed states and explains them with the experiment theory.