Assignment 01: Linux Architecture and Command Line Basics

While you will utilize the university’s lab servers for formal evaluations, establishing a local Linux environment on your personal machine is fundamentally required for this course. System-level education demands experimentation.

Local Installation Options:

A Note on System Experimentation: To truly comprehend operating system architectures, you must be willing to push boundaries. Do not fear causing system errors or misconfigurations within your virtual environments; dismantling and breaking existing structures is a mandatory step in learning how to engineer new, stable systems.


Part 1: System Navigation and Directory Architecture

Tutorial: The Linux file system is a hierarchical tree structure, beginning at the root directory (/). Understanding your current location and navigating this tree is the foundational skill of system administration.

Commands to Explore:

Action Items:

  1. Open your terminal and identify your absolute path.
  2. Create a new directory named using your student identification number.
  3. Change your working directory to this newly created folder.
  4. Execute a long listing of all hidden files in your current directory.

Variant Task: Consult the manual pages (using man ls) to find the flag that sorts directory contents by file size. Create three empty files, add varying amounts of text to them, and demonstrate sorting them by size using the ls command.


Part 2: File Creation, Viewing, and Moving

Tutorial: In UNIX/Linux, everything is treated as a file. The ability to quickly generate, copy, move, and review text files from the command line is essential for system configuration.

Commands to Explore:

Action Items:

  1. Create a file named sys_info.txt and write a brief sentence about your operating system.
  2. Append your current system date to the file using the append operator.
  3. Create a duplicate of this file named sys_backup.txt.
  4. Rename sys_backup.txt to sys_archive.txt using the move command.

Variant Task: Create a new subdirectory named archives. Move sys_archive.txt into this new directory using a single command containing absolute paths for both the source and destination.


Part 3: Text Editing and Standard Input/Output

Tutorial: Mastery of command-line text editors is non-negotiable for manipulating configuration files directly on a server. The vi editor is universally available on UNIX systems.

Commands to Explore:

Action Items:

  1. Open a new file named student_record.dat using vi.
  2. Enter insert mode and type three lines of mock student data using a pipe (|) as a delimiter (e.g., 01|John Doe|CSE).
  3. Save the file and exit the editor.
  4. Use the wc command to count the number of characters and lines in student_record.dat.

Variant Task: Re-open student_record.dat in vi. Yank (copy) the first line using the yy command and paste it at the bottom of the file using the p command. Exit without saving using the appropriate ex mode command.


Part 4: File Manipulation, Formatting, and Slicing

Tutorial: Often, you will deal with massive log files or data sets. Linux provides utilities to slice, filter, and format data directly from the shell without requiring complex scripts.

Commands to Explore:

Action Items:

  1. Using student_record.dat, extract only the student names (the second field) using the cut command and save the output to names.dat.
  2. Sort names.dat in reverse alphabetical order (consult manual for the reverse flag) and overwrite the file.
  3. Display the final sorted list using the pr command, adding a formal heading titled “Sorted Student Roster”.

Variant Task: Display student_record.dat with line numbers using the nl command. Use options -w3 to specify the width and -s" " to specify the separator.


Part 5: Advanced Pattern Matching and Pipelines

Tutorial: The true elegance of the UNIX philosophy is that tools are designed to do one thing well and to work together seamlessly. By using standard input/output redirection and the pipe operator (|), you can chain commands to execute complex operations.

Commands to Explore:

Action Items:

  1. Run a grep search on student_record.dat to find all records associated with the “CSE” department.

  2. Execute the who command to see current logged-in users.

  3. Pipe the output of who into tee, saving the data to a file named current_users.txt while simultaneously viewing it on your terminal screen.

Comprehensive Culminating Task: Construct a single pipeline of commands that accomplishes the following sequentially:

  1. Lists all files in the /etc directory using a long listing.
  2. Filters the output to only show lines containing the word “network”.
  3. Counts the exact number of lines resulting from that filter.
  4. Echoes a final sentence stating: “There are [Number] network-related configurations.” (Hint: Use command substitution with backticks, e.g., `command`).

Resources & Further Reading


📎 Attached Resources