Skip to content

This repository contains a Linux-based directory management assignment where various commands are used to manipulate files and directories in a structured manner. The goal is to practice and demonstrate proficiency in essential Linux commands like `mkdir`, `mv`, `cp`, `ls`, `cat`, and more.

License

Notifications You must be signed in to change notification settings

Yosef-AlSabbah/Linux-Directory-Management

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

πŸ–₯️ Linux Directory Management - OS Lab

πŸ“Œ Overview

This repository contains a Linux-based directory management assignment where various commands are used to manipulate files and directories in a structured manner. The goal is to practice and demonstrate proficiency in essential Linux commands like mkdir, mv, cp, ls, cat, and more.

πŸ‘©β€πŸ« Instructor: Malak Ghabayen

🏷️ Tags

  • Linux
  • Bash
  • File System
  • Terminal
  • CLI Commands

πŸ“‚ Directory Structure

/home/OS/Lab1/
β”œβ”€β”€ Archive/
β”œβ”€β”€ Customer/
β”œβ”€β”€ Finance/
β”‚   β”œβ”€β”€ Cust1.txt
β”‚   β”œβ”€β”€ Cust2.txt
β”‚   └── Cust3.txt
└── Public/
    β”œβ”€β”€ Forms/
    └── Info/
        └── Leave.txt

πŸ› οΈ Commands Used

Command Description
mkdir Creates directories
cd Changes directory
cd .. Moves to the parent directory
mv Moves or renames files/directories
cp Copies files/directories
ls Lists files and directories
cat Displays file content
clear Clears the terminal screen
exit Exits the terminal session

πŸ“œ Implementation Steps

πŸ—οΈ Step 1: Create Directory Structure

mkdir -p OS/Lab1/{Finance,Customer,Public/{Forms,Info},Archive} && \
cd OS/Lab1 && \
touch Finance/{Cust1.txt,Cust2.txt,Cust3.txt} \
      Public/Info/Leave.txt

πŸ“Œ Check Structure:

tree
.
β”œβ”€β”€ Archive
β”œβ”€β”€ Customer
β”œβ”€β”€ Finance
β”‚   β”œβ”€β”€ Cust1.txt
β”‚   β”œβ”€β”€ Cust2.txt
β”‚   └── Cust3.txt
└── Public
    β”œβ”€β”€ Forms
    └── Info
        └── Leave.txt

πŸ”„ Step 2: Move Customer Files to Customer/

mv Finance/* Customer
tree
.
β”œβ”€β”€ Archive
β”œβ”€β”€ Customer
β”‚   β”œβ”€β”€ Cust1.txt
β”‚   β”œβ”€β”€ Cust2.txt
β”‚   └── Cust3.txt
β”œβ”€β”€ Finance
└── Public
    β”œβ”€β”€ Forms
    └── Info

πŸ“‚ Step 3: Copy Customer Files to Archive/

cp Customer/* Archive
tree
.
β”œβ”€β”€ Archive
β”‚   β”œβ”€β”€ Cust1.txt
β”‚   β”œβ”€β”€ Cust2.txt
β”‚   └── Cust3.txt
β”œβ”€β”€ Customer
β”‚   β”œβ”€β”€ Cust1.txt
β”‚   β”œβ”€β”€ Cust2.txt
β”‚   └── Cust3.txt
β”œβ”€β”€ Finance
└── Public
    β”œβ”€β”€ Forms
    └── Info

πŸ“ Step 4: Move Leave.txt and Rename it to leave_old.txt

mv Public/Info/Leave.txt Archive/leave_old.txt
tree
.
β”œβ”€β”€ Archive
β”‚   β”œβ”€β”€ Cust1.txt
β”‚   β”œβ”€β”€ Cust2.txt
β”‚   β”œβ”€β”€ Cust3.txt
β”‚   └── leave_old.txt
β”œβ”€β”€ Customer
β”‚   β”œβ”€β”€ Cust1.txt
β”‚   β”œβ”€β”€ Cust2.txt
β”‚   └── Cust3.txt
β”œβ”€β”€ Finance
└── Public
    β”œβ”€β”€ Forms
    └── Info

πŸ“ Step 5: Move leave_old.txt to Forms/

mv Archive/leave_old.txt Public/Forms/
tree
.
β”œβ”€β”€ Archive
β”‚   β”œβ”€β”€ Cust1.txt
β”‚   β”œβ”€β”€ Cust2.txt
β”‚   β”œβ”€β”€ Cust3.txt
β”œβ”€β”€ Customer
β”‚   β”œβ”€β”€ Cust1.txt
β”‚   β”œβ”€β”€ Cust2.txt
β”‚   └── Cust3.txt
β”œβ”€β”€ Finance
└── Public
    β”œβ”€β”€ Forms
    β”‚   └── leave_old.txt
    └── Info

βœ… Step 6: Verify Files in Customer/ and Archive/

cd Customer && tree
.
β”œβ”€β”€ Cust1.txt
β”œβ”€β”€ Cust2.txt
└── Cust3.txt
cd ../Archive && tree
.
β”œβ”€β”€ Cust1.txt
β”œβ”€β”€ Cust2.txt
└── Cust3.txt

πŸ—‘οΈ Step 7: Delete Files in Customer/

cd ../Customer/ && rm *
tree
.
(empty)

πŸ“œ Step 8: Display Contents of Text Files

cd ../ && cat {Archive,Public/Forms}/*.txt
Dear Instructor, I promise I didn’t use ChatGPT for this... or did I? 😏
I worked so hard, even my laptop cried. Please reward me with a 100%! πŸ₯Ί
If I don’t get 100%, my pet rock will be very disappointed. πŸͺ¨
P.S. I’ll name my firstborn after you if you give me full marks. Deal? 🀝

πŸ”„ Step 9: Clear Screen & Exit (Do it Yourself πŸ˜‰)

clear
exit

🎯 Conclusion

This lab covers essential file system commands in Linux, providing hands-on experience with directory structures, file movement, copying, renaming, deletion, and file content display. This structured approach helps in understanding hierarchical file management in Linux environments.


🌟 Happy Coding! πŸš€

About

This repository contains a Linux-based directory management assignment where various commands are used to manipulate files and directories in a structured manner. The goal is to practice and demonstrate proficiency in essential Linux commands like `mkdir`, `mv`, `cp`, `ls`, `cat`, and more.

Topics

Resources

License

Stars

Watchers

Forks