Skip to main content

Practical Tasks - UD06

These tasks provide practical experience with file systems, commands, and file management.

File System Navigation

Task 1: Basic File Commands

Objective: Understand absolute and relative paths
  1. What does cd .. do in both Linux and Windows?
  2. Describe in your own words:
    • What is an absolute path?
    • What is a relative path?
    • Give examples of each
Deliverable: Written explanations with examples
Objective: Learn equivalent commands across systemsComplete the table:
Windows (PowerShell)Linux (Bash)Description
Get-ContentView file contents
mkdirCreate directory
Get-ChildItem -Force C:\List all files including hidden
touch ficheroVacio.txtCreate empty file
Copy-Item -Path C:\asir -Destination C:\copiaAsirCopy directory
rm -rf /asir/carpetaABorrarDelete directory recursively
Rename-Item C:\asir\prueba.txt -NewName prueba2.txtRename file
Objective: Understand command optionsExplain why this command doesn’t fail:
mkdir -p RutaQueNoExiste/CarpetaQueQueremos
Hint: What does the -p option do?

Task 2: Script Translation

Objective: Translate PowerShell to BASHConvert this PowerShell script to BASH:
$FileName = 'C:\asir\log.txt'
If (Test-Path $FileName){
   Remove-Item $FileName
}
Your BASH script:
#!/bin/bash
# Your solution here
Objective: Translate PowerShell to BASHConvert this PowerShell script to BASH:
$DESTINO = 'C:\asir\ficherosDeTexto'
New-Item -Type directory -Name $DESTINO
Copy-Item -Filter *.txt -Path C:\asir\ -Destination $DESTINO
Your BASH script:
#!/bin/bash
# Your solution here
Objective: Translate PowerShell to BASHConvert this PowerShell script to BASH:
$files = Get-ChildItem -Path C:\asir
foreach ($file in $files)
{
    $newFileName=$file.Name.Replace("A","B") 
    Rename-Item $file $newFileName
}
Your BASH script:
#!/bin/bash
# Your solution here
Hint: Use parameter expansion ${variable//search/replace} or sed command

Linux File Operations

Task 3: Using find Command

Objective: Understand the find commandDescribe what each find command does:
# 1
find /dev/ -iname sda*

# 2
find /lib -name libc* -type f

# 3
find /usr/share -type l 

# 4
find /tmp -user $USER

# 5
find /usr/bin/ -type f -executable

# 6
find /var/log/ -daystart -ctime -1

# 7 (this is difficult)
find /boot/ -follow -lname "*"

# 8
find /tmp/ -mtime +31 -delete

# 9
find ./ -size +100M
Research:
  • What does -iname do?
  • What’s the difference between -name and -iname?
  • What is -type f vs -type l?
  • What does -mtime +31 mean?
  • Why is command #8 dangerous?

Task 4: File Information

Objective: Find PowerShell equivalentThe Linux file command shows file type information:
file document.pdf
# Output: document.pdf: PDF document, version 1.4

file script.sh
# Output: script.sh: Bash script, ASCII text executable
Task:
  1. Research and find a PowerShell cmdlet with similar functionality
  2. Demonstrate with examples
  3. Compare the outputs

Windows File System

Task 5: Drive Letter Management

Objective: Understand drive mappingExplain what happens when you run:
subst M: $env:ProgramFiles
Questions:
  1. What appears in File Explorer?
  2. What is M:\ pointing to?
  3. What are practical uses for this?
  4. How do you remove the mapping?
  5. Is the mapping permanent?

Advanced File System Tasks

Task 6: File System Exploration

Objective: Explore Windows directory structure
1

Document System Directories

Create a table of important Windows directories:
DirectoryPurposeExample ContentsCan Delete?
C:\Windows
C:\Program Files
C:\Users
C:\ProgramData
C:\Windows\System32
2

Environment Variables

List and explain 10 important Windows environment variables
3

User Profile Structure

Document your user profile structure
C:\Users\YourName\
├── Desktop
├── Documents
...
Objective: Explore Linux directory hierarchy
1

Document Important Directories

Create a comprehensive table:
DirectoryPurposeTypical SizeCan Delete?
/
/boot
/etc
/home
/var
/tmp
/usr
2

Check Disk Usage

df -h
du -sh /*
Document which directories use most space
3

Explore /etc

List and explain 15 important files in /etc

Comprehensive Challenges

Task 8: 11 de Febrero - Ada Lovelace Day

This is a comprehensive exercise combining file systems, permissions, and automation.
Scenario: Create a tribute to Ada Lovelace with an automated file system structure.Requirements:
1

Directory Structure

Create:
/tribute/ada_lovelace/
├── biography/
├── achievements/
├── legacy/
└── resources/
2

Populate with Content

  • Download or create relevant content
  • Organize into appropriate folders
  • Include text files with information
3

Set Permissions

  • Everyone can read
  • Only admins can modify
  • Executable files in resources
4

Create Automation Script

Script should:
  • Create entire structure
  • Set all permissions
  • Generate summary report
  • Work on both Windows and Linux

Task 9: File System Partition Project

Objective: Understand partitioning and formattingResearch:
  1. What is a partition?
  2. Difference between MBR and GPT
  3. File system format comparison:
    • NTFS vs FAT32 vs exFAT (Windows)
    • ext4 vs xfs vs btrfs (Linux)
Practical (Virtual Environment Recommended):
  1. Create virtual disk in VirtualBox/VMware
  2. Partition the disk
  3. Format with different file systems
  4. Compare performance and features
  5. Document everything

Task 10: System Cleanup Automation

Objective: Automate cleanup of temporary filesCreate PowerShell script that:
  1. Cleans Windows temp folder
  2. Cleans user temp folder
  3. Cleans browser caches
  4. Removes old log files
  5. Empties Recycle Bin
  6. Reports space freed
  7. Logs all actions
#!/usr/bin/env pwsh
# System Cleanup Script
Test carefully! Don’t delete important files.
Objective: Automate cleanup of temporary filesCreate BASH script that:
  1. Cleans /tmp (preserving system files)
  2. Cleans package manager cache
  3. Removes old log files from /var/log
  4. Finds and reports large files
  5. Identifies old files in /home
  6. Reports space freed
  7. Logs all actions
#!/bin/bash
# System Cleanup Script

Submission Guidelines

What to Submit:
  • All scripts in ZIP file: UD06_Tasks_YourName.zip
  • Completed tables and documentation
  • Screenshots where requested
  • README.md explaining:
    • How to run each script
    • What each script does
    • Test results
    • Challenges encountered
Script Requirements:
  • Include comments
  • Error handling
  • Clear output messages
  • Tested and working

Grading Criteria

CriteriaPoints
Command understanding25%
Script functionality30%
Cross-platform knowledge20%
Documentation quality15%
Advanced features10%
Testing:
  • Test all scripts before submission
  • Test in clean environment
  • Verify file operations don’t cause data loss
  • Document any system requirements

Additional Resources

Windows Docs

Microsoft documentation on file systems and PowerShell commands

Linux Man Pages

man hier - File system hierarchy description

FHS Standard

Filesystem Hierarchy Standard documentation

Bash Guide

Advanced Bash-Scripting Guide for file operations

Build docs developers (and LLMs) love