← CSE107 lab materials

CSE107 · Lab 1 · Files and paths on Ubuntu

Friday 2 October 2026 · Assigned two-hour session · Review version 1

Result to demonstrate

Create and navigate a small directory tree, save/edit short text, correct a misplaced file and verify the result. Explain paths and a simple binary value. Adapted from the previous planets activity; astronomy research and a full terminal recording are not required.

Work only inside your own new lab workspace. Commands below assume an Ubuntu shell. Do not type the prompt symbol $. If a command reports an error, read it before trying again. Do not use sudo or recursive deletion for this exercise.

A. Create your workspace

cd ~
mkdir -p cse107
cd cse107
mkdir lab01
cd lab01
pwd
mkdir -p planets/mars planets/jupiter/io planets/jupiter/europa planets/saturn
cd planets

If lab01 already exists, stop and ask the TA for a fresh folder name; do not overwrite previous work. Record the absolute path printed by pwd. Within planets, create mars/mars.txt and saturn/saturn.txt, each with two short lines. Content may simply name the object and say it is a planet; no research is needed. Use the supplied reference or a text editor available on the lab PC, then read the saved files using cat.

B. Correct a misplaced file

Create the following deliberately misplaced file while in planets:

printf 'Io\nA moon of Jupiter\n' > jupiter/europa/io.txt

Move it into jupiter/io/ using mv. Preserve the filename. Confirm the source no longer has the file and the destination does. Use ls and cat; do not infer success from silence alone.

C. Navigate and explain

Starting in planets/jupiter/io, visit jupiter, then saturn, then return to planets. Use relative paths for these steps and run pwd at each stop. Record the commands and resulting paths in evidence.txt using a text editor or a short copied terminal excerpt. A full session transcript is not required.

Append Checked in Lab 1 to mars/mars.txt without losing its existing two lines. Verify the contents. Explain to the TA the difference between > and >>.

D. Verify and revisit

While in planets, run:

find . -type f
cat mars/mars.txt
cat jupiter/io/io.txt

The required files are mars/mars.txt, saturn/saturn.txt and jupiter/io/io.txt. Additional evidence files are acceptable. jupiter/europa/io.txt must no longer exist. File listing order is not important.

In evidence.txt, show how 11010 equals a decimal value, and write decimal 9 using four bits. Finish with one sentence explaining an absolute versus a relative path. Keep the evidence file in lab01, alongside planets.

E. Demonstrate and retain your work

Show the TA your folder tree, corrected file, appended text, navigation evidence and binary explanation. Be ready to navigate to a folder named by the TA. Save your files using the institution's approved storage/submission route before logging out; local files may not persist on shared PCs.

For the report, retain the planets folder and evidence.txt. Submission packaging and the exact Teams assignment will be announced. Capture evidence now; the report asks you to explain this work, not create a second program.

Optional if finished: copy mars.txt to a second filename using cp, change only the copy and demonstrate that the original is unchanged. No additional hardware or large extension is required.