An open API service indexing awesome lists of open source software.

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.

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! πŸš€