10
CO4
Linux / CLI Intermediate ⏱ 3 Hours

Build knowledge of the Linux File System, study and execute the following Linux and Windows Shell Commands such as mkdir, pwd, ls, cp, cd, mv, rm, rmdir, touch, free, and System Related Commands

🎯

Aim / Objective

To understand the Linux Filesystem Hierarchy Standard (FHS), contrast it with Windows drive letters, and study, execute, and master fundamental command-line shell utilities: `mkdir`, `pwd`, `ls`, `cp`, `cd`, `mv`, `rm`, `rmdir`, `touch`, `free`, and system diagnostic commands in Linux and Windows.

🧰

Hardware & Software Requirements

Hardware Components

  • PC running Ubuntu/Debian Linux (native installation, dual-boot, or VirtualBox VM), or Windows 10/11 with WSL2 (Windows Subsystem for Linux)
  • Keyboard and Display

Software, OS & Tools

  • Linux Bash Shell (`/bin/bash`) or Zsh
  • Windows Command Prompt (`cmd.exe`) and PowerShell 7
👨‍🏫

Teacher's Lab Delivery Guide

Essential briefing notes, pedagogy, and setup tips for lab instructors
Faculty Exclusive

⏱ 5-Minute Pre-Lab Lecture Briefing:

Contrast the Windows world (`C:\`, `D:\`, drive letters, backslashes, case-insensitive) with the Linux world (single unified inverted tree starting at root `/`, forward slashes, strictly case-sensitive, everything is a file). Explain that in Linux, terminal skills are not an optional extra—they are the primary superpower of system administrators and cloud engineers.

📝 Key Concepts to Write on Whiteboard:

  • Linux Filesystem Hierarchy Standard (FHS): `/` (root), `/bin` (user binaries), `/etc` (system configuration), `/home` (user home directories), `/var` (variable logs/spools), `/dev` (device files), `/proc` (kernel virtual filesystem)
  • Absolute paths (starts with `/`) vs Relative paths (starts with current directory, `./` or `../`)
  • The "Everything is a File" philosophy (hardware devices, processes, sockets are treated as file streams)
  • Standard directory commands: `pwd`, `cd`, `mkdir -p`, `rmdir`, `ls -la`
  • File manipulation commands: `touch`, `cp -r`, `mv`, `rm -rf`, `cat`, `head`, `tail`
  • System diagnostic commands: `free -m` (memory), `df -h` (disk usage), `uname -a` (kernel), `top`/`htop` (processes), `uptime`
⚙ Pre-Class Lab Setup:

Provide students with standard non-root user accounts. Warn them about the perils of `rm -rf /` and running as `root` indiscriminately.

⚠ Common Student Pitfalls & Fixes:

Students confuse relative paths and absolute paths, or put spaces inside filenames without quotes (`mkdir my folder` creates two folders "my" and "folder" instead of "my folder").

🛡 Lab Safety & ESD Precautions:

Never run `rm -rf *` without first double-checking your current location with `pwd`!

📜

Step-by-Step Practical Procedure

1

Inspect Linux Filesystem Hierarchy & Current Working Directory

Launch terminal. Print the current working directory. List the top-level root directory contents with permissions and hidden files.

Command / Action:
pwd && ls -la /
💡
Teacher Note / Pro-Tip: Notice `/bin`, `/etc`, `/home`, `/root`, `/sys`, `/proc`, and `/var`.
2

Create Directory Trees with `mkdir` & Navigate with `cd`

Create a nested directory structure in one command using the `-p` (parents) flag. Navigate into the directory and then return to home using relative and absolute paths.

Command / Action:
mkdir -p ~/cse_lab/module1/practical10 && cd ~/cse_lab/module1/practical10
💡
Teacher Note / Pro-Tip: `cd ..` navigates one level up; `cd ~` or just `cd` returns to user home directory.
3

Create Empty Files with `touch` and Write Content

Create new empty files using `touch`. Write sample text to a file using redirection (`>`) and append (`>>`). Display contents using `cat`.

Command / Action:
touch notes.txt config.cfg && echo "Hardware Lab 2026" > notes.txt && cat notes.txt
💡
Teacher Note / Pro-Tip: `>` overwrites existing file content; `>>` appends to the end without erasing.
4

Copy (`cp`) and Move / Rename (`mv`) Files & Directories

Copy `notes.txt` to a backup file. Rename `config.cfg` to `settings.conf` using `mv`. Copy the entire directory recursively with `cp -r`.

Command / Action:
cp notes.txt notes_backup.txt && mv config.cfg settings.conf
💡
Teacher Note / Pro-Tip: In Linux, renaming and moving are the identical command (`mv`).
5

Delete Files (`rm`) and Directories (`rmdir` / `rm -r`)

Remove the backup file. Use `rmdir` on an empty folder. Attempt `rmdir` on a non-empty folder (it fails), then use `rm -r` for recursive removal.

Command / Action:
rm notes_backup.txt && rm -r ~/cse_lab/module1
💡
Teacher Note / Pro-Tip: Linux has no Recycle Bin for terminal commands; files removed with `rm` are unlinked permanently.
6

Execute System Diagnostic Commands (`free`, `df`, `uname`, `top`)

Check physical and swap memory in megabytes using `free -m`. Check disk filesystem utilization in human-readable gigabytes (`df -h`). Display kernel and OS details (`uname -a`).

Command / Action:
free -m && df -h && uname -a
💡
Teacher Note / Pro-Tip: In Windows PowerShell, equivalent system commands are `systeminfo`, `Get-PSDrive`, and `Get-Process`.

Interactive Hands-On Lab Simulator

Practice and test concepts virtually before or after performing on physical lab equipment
Live Interactive
Loading simulator...
📊

Observations & Student Lab Record

Students are required to record the following measured parameters, hardware specifications, and output status into their physical lab journals:

Linux Command Function / Purpose Key Options / Switches Windows Equivalent Command
`pwd` Print Working Directory (shows absolute path) None `cd` (without arguments) / `Get-Location`
`ls` List directory contents `-l` (long format), `-a` (all/hidden), `-h` (human sizes) `dir` / `Get-ChildItem`
`cd` Change directory `..` (parent), `~` (home), `-` (previous directory) `cd` / `chdir`
`mkdir` Make directory `-p` (create parent directories without error) `mkdir` / `md`
`touch` Create empty file or update timestamp `-a` (access time only) `type nul > file.txt` / `New-Item`
`cp` Copy files and directories `-r` (recursive), `-v` (verbose), `-i` (interactive prompt) `copy` / `xcopy` / `robocopy`
`mv` Move or rename files and directories `-f` (force), `-n` (do not overwrite) `move` / `ren`
`rm` Remove files or directories `-r` (recursive), `-f` (force without prompt) `del` / `rmdir /s` / `Remove-Item`
`rmdir` Remove empty directory `-p` (remove empty parents) `rd` / `rmdir`
`free` Display total, used, and free RAM and Swap `-m` (Megabytes), `-g` (Gigabytes), `-h` (Human) `systeminfo | findstr Memory`
`uname` Display OS and kernel release information `-a` (all details), `-r` (kernel release) `winver` / `systeminfo`
💡

Conclusions & Learning Outcome

The Linux Filesystem Hierarchy Standard was thoroughly analyzed. Hands-on execution of directory management (`pwd`, `cd`, `mkdir`, `rmdir`), file operations (`touch`, `cp`, `mv`, `rm`), and system telemetry commands (`free -m`, `df -h`, `uname -a`) demonstrated proficiency in command-line administration, reinforcing parity with Windows equivalents.

Oral Exam & Viva Questions with Answers

Essential questions asked by external examiners and lab evaluators (Accordion UI)
Answer:

In Linux, all files, directories, mounted storage partitions, and devices branch under a single unified root directory symbolized by `/`. In contrast, Windows assigns independent drive letters (`C:`, `D:`, `E:`) to separate storage partitions.