https://github.com/yosef-alsabbah/linux-directory-management
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.
https://github.com/yosef-alsabbah/linux-directory-management
bash cli-commands file-system linux terminal
Last synced: 10 months ago
JSON representation
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.
- Host: GitHub
- URL: https://github.com/yosef-alsabbah/linux-directory-management
- Owner: Yosef-AlSabbah
- License: mit
- Created: 2025-03-05T10:29:44.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-05T10:45:26.000Z (over 1 year ago)
- Last Synced: 2025-07-30T06:40:07.478Z (11 months ago)
- Topics: bash, cli-commands, file-system, linux, terminal
- Homepage:
- Size: 7.74 MB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# π₯οΈ 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
```bash
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:**
```bash
tree
```
```
.
βββ Archive
βββ Customer
βββ Finance
β βββ Cust1.txt
β βββ Cust2.txt
β βββ Cust3.txt
βββ Public
βββ Forms
βββ Info
βββ Leave.txt
```
---
### π Step 2: Move Customer Files to `Customer/`
```bash
mv Finance/* Customer
tree
```
```
.
βββ Archive
βββ Customer
β βββ Cust1.txt
β βββ Cust2.txt
β βββ Cust3.txt
βββ Finance
βββ Public
βββ Forms
βββ Info
```
---
### π Step 3: Copy Customer Files to `Archive/`
```bash
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`
```bash
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/`
```bash
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/`
```bash
cd Customer && tree
```
```
.
βββ Cust1.txt
βββ Cust2.txt
βββ Cust3.txt
```
```bash
cd ../Archive && tree
```
```
.
βββ Cust1.txt
βββ Cust2.txt
βββ Cust3.txt
```
---
### ποΈ Step 7: Delete Files in `Customer/`
```bash
cd ../Customer/ && rm *
tree
```
```
.
(empty)
```
---
### π Step 8: Display Contents of Text Files
```bash
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 π)
```bash
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! π