From 0dbfd9a580a839c320b1598da468daa9a487eec4 Mon Sep 17 00:00:00 2001 From: John Martin Date: Fri, 27 Mar 2026 06:12:59 +0800 Subject: [PATCH] ci: add ShellCheck and yamlint workflow --- CONTRIBUTING.md | 36 +- README.md | 314 +++++++-------- level-0-linux/README.md | 100 ++--- level-0-linux/concepts/README.md | 22 +- .../concepts/basics/file-permissions.md | 260 ++++++------- level-0-linux/concepts/commands.md | 216 +++++------ .../tasks/log-cleaner-backup/Readme.md | 48 +-- .../tasks/log-cleaner-backup/log_cleaner.sh | 64 +-- .../tasks/system-health-auditor/readme.md | 364 +++++++++--------- .../system-health-auditor/system_audit.sh | 0 level-1-shell-scripting/README.md | 100 ++--- .../basics/basics/README.md | 258 ++++++------- level-1-shell-scripting/basics/basics/echo.sh | 1 + .../basics/basics/hello.sh | 0 .../basics/basics/loops.sh | 1 - .../basics/intermediate/backup-script.sh | 1 + level-2-git-github/README.md | 100 ++--- level-2-git-github/basics/README.md | 316 +++++++-------- .../projects/project-1-git-workflow/README.md | 294 +++++++------- level-3-docker/README.md | 100 ++--- level-3-docker/docker-basics/README.md | 106 ++--- level-4-kubernetes/README.md | 100 ++--- level-5-ci-cd/README.md | 100 ++--- level-6-cloud-aws/README.md | 100 ++--- workflows/ci.yml | 64 +-- workflows/lint.yml | 39 ++ 26 files changed, 1572 insertions(+), 1532 deletions(-) mode change 100755 => 100644 level-0-linux/tasks/system-health-auditor/system_audit.sh mode change 100755 => 100644 level-1-shell-scripting/basics/basics/hello.sh create mode 100644 workflows/lint.yml diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4c7b9d1..57df7c7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,18 +1,18 @@ -# Contributing Guidelines - -Thank you for contributing πŸš€ - -## How to Contribute -1. Fork the repository -2. Create a new branch (`feature/your-feature-name`) -3. Commit your changes with clear messages -4. Push and open a Pull Request - -## Rules -- Follow folder structure -- Add comments to scripts -- No plagiarized content -- One feature per PR - -## Beginner Friendly -This repo supports first-time contributors. +# Contributing Guidelines + +Thank you for contributing πŸš€ + +## How to Contribute +1. Fork the repository +2. Create a new branch (`feature/your-feature-name`) +3. Commit your changes with clear messages +4. Push and open a Pull Request + +## Rules +- Follow folder structure +- Add comments to scripts +- No plagiarized content +- One feature per PR + +## Beginner Friendly +This repo supports first-time contributors. diff --git a/README.md b/README.md index a0815b4..854b11a 100644 --- a/README.md +++ b/README.md @@ -1,157 +1,157 @@ -# DevOps Learning Repository - -## Overview -This repository is an **open-source DevOps learning hub** focused on helping students and beginners gain **practical, hands-on DevOps experience** through real examples, clean structure, and open-source collaboration. - -The project is designed to grow step by stepβ€”from Linux fundamentals to CI/CD and cloudβ€”while encouraging contributors to learn by doing. - ---- - -## Goals -- Provide a structured DevOps learning path -- Help beginners make their first open-source contributions -- Share practical DevOps examples and scripts -- Build real-world DevOps skills through collaboration - ---- - - -## 🧭 Learning Path (Recommended) - -1. Linux Fundamentals β†’ `linux/basics` -2. Shell Scripting β†’ `shell-scripting` -3. Docker Basics β†’ `docker` -4. Kubernetes β†’ `kubernetes` -5. CI/CD Pipelines β†’ `ci-cd` -6. Cloud & Automation β†’ `cloud` - ---- - -## Repository Structure - -```text -Devops/ -β”œβ”€β”€ linux/ -β”‚ β”œβ”€β”€ basics/ -β”‚ β”œβ”€β”€ intermediate/ -β”‚ └── advanced/ -β”‚ -β”œβ”€β”€ shell-scripting/ -β”‚ β”œβ”€β”€ basics/ -β”‚ β”œβ”€β”€ intermediate/ -β”‚ └── challenges/ -β”‚ -β”œβ”€β”€ docker/ -β”‚ β”œβ”€β”€ basics/ -β”‚ └── mini-projects/ -β”‚ -β”œβ”€β”€ kubernetes/ -β”‚ └── basics/ -β”‚ -β”œβ”€β”€ ci-cd/ -β”‚ └── github-actions/ -β”‚ -β”œβ”€β”€ cloud/ -β”‚ └── aws/ -β”‚ -β”œβ”€β”€ CONTRIBUTING.md -β”œβ”€β”€ CODE_OF_CONDUCT.md -β”œβ”€β”€ LICENSE -└── README.md -``` - ---- - -## Sections Explained - -### Linux -Covers Linux fundamentals from basic commands to intermediate and advanced concepts such as file permissions and process management. - -### Shell Scripting -Contains beginner to intermediate shell scripts with clear comments and real-world challenges. - -### Docker -Introduces containerization concepts using simple Dockerfiles and small hands-on examples. - -### Kubernetes -Includes basic Kubernetes YAML files to understand orchestration fundamentals. - -### CI/CD -Demonstrates CI/CD concepts using GitHub Actions and automation workflows. - -#### GitHub Actions CI Example -This repository includes a **basic GitHub Actions CI workflow** to help beginners understand Continuous Integration. - -**What this workflow does:** -- Runs automatically on every push and pull request -- Checks out the repository code -- Runs a simple sanity check to confirm CI execution - -**Workflow location:** -```text -.github/workflows/ci.yml - -### Cloud -Focuses on cloud fundamentals, starting with AWS basics. - ---- - -## Suggested Learning Path -1. Linux basics (`linux/basics`) -2. Shell scripting fundamentals (`shell-scripting/basics`) -3. Docker and container concepts (`docker/basics`) -4. Kubernetes basics (`kubernetes/basics`) -5. CI/CD automation (`ci-cd/github-actions`) -6. Cloud fundamentals (`cloud/aws`) - ---- - -## Contributing -Contributions are welcome, especially from beginners. - -### How to Contribute -1. Fork the repository -2. Create a new branch for your changes -3. Follow the existing folder structure -4. Commit changes with clear messages -5. Open a Pull Request - -Please read **CONTRIBUTING.md** before submitting a pull request. - -Beginner-friendly tasks are labeled as **good first issue**. - ---- - -## Contribution Rules -- Follow the repository structure -- Write clean, readable, and original content -- Add comments where required -- Avoid large or unrelated changes in a single PR -- Keep pull requests focused - ---- - -## Code of Conduct -This project follows a Code of Conduct to maintain a respectful and inclusive environment for all contributors. - -Refer to **CODE_OF_CONDUCT.md** for details. - ---- - -## License -This project is licensed under the **MIT License**. -See the **LICENSE** file for more information. - ---- - -## Maintainer -Maintained by **@iamdevdhanush**. -Pull requests and issues are actively reviewed. - ---- - -## Support -If you find this repository useful: -- Star the repository -- Share it with others -- Contribute to help it grow +# DevOps Learning Repository + +## Overview +This repository is an **open-source DevOps learning hub** focused on helping students and beginners gain **practical, hands-on DevOps experience** through real examples, clean structure, and open-source collaboration. + +The project is designed to grow step by stepβ€”from Linux fundamentals to CI/CD and cloudβ€”while encouraging contributors to learn by doing. + +--- + +## Goals +- Provide a structured DevOps learning path +- Help beginners make their first open-source contributions +- Share practical DevOps examples and scripts +- Build real-world DevOps skills through collaboration + +--- + + +## 🧭 Learning Path (Recommended) + +1. Linux Fundamentals β†’ `linux/basics` +2. Shell Scripting β†’ `shell-scripting` +3. Docker Basics β†’ `docker` +4. Kubernetes β†’ `kubernetes` +5. CI/CD Pipelines β†’ `ci-cd` +6. Cloud & Automation β†’ `cloud` + +--- + +## Repository Structure + +```text +Devops/ +β”œβ”€β”€ linux/ +β”‚ β”œβ”€β”€ basics/ +β”‚ β”œβ”€β”€ intermediate/ +β”‚ └── advanced/ +β”‚ +β”œβ”€β”€ shell-scripting/ +β”‚ β”œβ”€β”€ basics/ +β”‚ β”œβ”€β”€ intermediate/ +β”‚ └── challenges/ +β”‚ +β”œβ”€β”€ docker/ +β”‚ β”œβ”€β”€ basics/ +β”‚ └── mini-projects/ +β”‚ +β”œβ”€β”€ kubernetes/ +β”‚ └── basics/ +β”‚ +β”œβ”€β”€ ci-cd/ +β”‚ └── github-actions/ +β”‚ +β”œβ”€β”€ cloud/ +β”‚ └── aws/ +β”‚ +β”œβ”€β”€ CONTRIBUTING.md +β”œβ”€β”€ CODE_OF_CONDUCT.md +β”œβ”€β”€ LICENSE +└── README.md +``` + +--- + +## Sections Explained + +### Linux +Covers Linux fundamentals from basic commands to intermediate and advanced concepts such as file permissions and process management. + +### Shell Scripting +Contains beginner to intermediate shell scripts with clear comments and real-world challenges. + +### Docker +Introduces containerization concepts using simple Dockerfiles and small hands-on examples. + +### Kubernetes +Includes basic Kubernetes YAML files to understand orchestration fundamentals. + +### CI/CD +Demonstrates CI/CD concepts using GitHub Actions and automation workflows. + +#### GitHub Actions CI Example +This repository includes a **basic GitHub Actions CI workflow** to help beginners understand Continuous Integration. + +**What this workflow does:** +- Runs automatically on every push and pull request +- Checks out the repository code +- Runs a simple sanity check to confirm CI execution + +**Workflow location:** +```text +.github/workflows/ci.yml + +### Cloud +Focuses on cloud fundamentals, starting with AWS basics. + +--- + +## Suggested Learning Path +1. Linux basics (`linux/basics`) +2. Shell scripting fundamentals (`shell-scripting/basics`) +3. Docker and container concepts (`docker/basics`) +4. Kubernetes basics (`kubernetes/basics`) +5. CI/CD automation (`ci-cd/github-actions`) +6. Cloud fundamentals (`cloud/aws`) + +--- + +## Contributing +Contributions are welcome, especially from beginners. + +### How to Contribute +1. Fork the repository +2. Create a new branch for your changes +3. Follow the existing folder structure +4. Commit changes with clear messages +5. Open a Pull Request + +Please read **CONTRIBUTING.md** before submitting a pull request. + +Beginner-friendly tasks are labeled as **good first issue**. + +--- + +## Contribution Rules +- Follow the repository structure +- Write clean, readable, and original content +- Add comments where required +- Avoid large or unrelated changes in a single PR +- Keep pull requests focused + +--- + +## Code of Conduct +This project follows a Code of Conduct to maintain a respectful and inclusive environment for all contributors. + +Refer to **CODE_OF_CONDUCT.md** for details. + +--- + +## License +This project is licensed under the **MIT License**. +See the **LICENSE** file for more information. + +--- + +## Maintainer +Maintained by **@iamdevdhanush**. +Pull requests and issues are actively reviewed. + +--- + +## Support +If you find this repository useful: +- Star the repository +- Share it with others +- Contribute to help it grow diff --git a/level-0-linux/README.md b/level-0-linux/README.md index f8bd810..ed9d237 100644 --- a/level-0-linux/README.md +++ b/level-0-linux/README.md @@ -1,50 +1,50 @@ -# Level 0: Linux Foundations - -## πŸ“Œ Objective -Learn essential Linux concepts required for DevOps, including filesystems, processes, networking, and permissions. - ---- - -## 🧠 What You Will Learn -- Core concepts related to this level -- Hands-on practical skills -- Real-world DevOps use cases - ---- - -## πŸ“‚ Folder Structure -- `concepts/` or `basics/` β†’ Theory and explanations -- `tasks/` or `projects/` β†’ Hands-on exercises -- `solutions/` β†’ Reference implementations (optional) - ---- - -## βœ… Prerequisites -- Basic Linux knowledge -- Willingness to practice (not just read) - ---- - -## πŸ§ͺ How to Use This Level -1. Read the concepts -2. Complete the tasks -3. Try projects without looking at solutions -4. Compare with solutions only after attempting - ---- - -## 🀝 Contribution Guidelines -You can contribute by: -- Adding tasks -- Improving explanations -- Fixing mistakes -- Adding real-world examples - -Follow the main `CONTRIBUTING.md` rules. - ---- - -## πŸš€ Progression -Complete this level before moving to the next one in the roadmap. - -Happy Learning & Building πŸ› οΈ +# Level 0: Linux Foundations + +## πŸ“Œ Objective +Learn essential Linux concepts required for DevOps, including filesystems, processes, networking, and permissions. + +--- + +## 🧠 What You Will Learn +- Core concepts related to this level +- Hands-on practical skills +- Real-world DevOps use cases + +--- + +## πŸ“‚ Folder Structure +- `concepts/` or `basics/` β†’ Theory and explanations +- `tasks/` or `projects/` β†’ Hands-on exercises +- `solutions/` β†’ Reference implementations (optional) + +--- + +## βœ… Prerequisites +- Basic Linux knowledge +- Willingness to practice (not just read) + +--- + +## πŸ§ͺ How to Use This Level +1. Read the concepts +2. Complete the tasks +3. Try projects without looking at solutions +4. Compare with solutions only after attempting + +--- + +## 🀝 Contribution Guidelines +You can contribute by: +- Adding tasks +- Improving explanations +- Fixing mistakes +- Adding real-world examples + +Follow the main `CONTRIBUTING.md` rules. + +--- + +## πŸš€ Progression +Complete this level before moving to the next one in the roadmap. + +Happy Learning & Building πŸ› οΈ diff --git a/level-0-linux/concepts/README.md b/level-0-linux/concepts/README.md index 919b742..d30e285 100644 --- a/level-0-linux/concepts/README.md +++ b/level-0-linux/concepts/README.md @@ -1,11 +1,11 @@ -# Linux Section 🐧 - -This folder contains Linux learning materials divided into: -- basics β†’ beginner commands -- intermediate β†’ scripting & process handling -- advanced β†’ system-level concepts - -### How to Contribute -- Add command examples -- Add explanations -- Improve organization +# Linux Section 🐧 + +This folder contains Linux learning materials divided into: +- basics β†’ beginner commands +- intermediate β†’ scripting & process handling +- advanced β†’ system-level concepts + +### How to Contribute +- Add command examples +- Add explanations +- Improve organization diff --git a/level-0-linux/concepts/basics/file-permissions.md b/level-0-linux/concepts/basics/file-permissions.md index 33ee6b9..b396363 100644 --- a/level-0-linux/concepts/basics/file-permissions.md +++ b/level-0-linux/concepts/basics/file-permissions.md @@ -1,130 +1,130 @@ -# πŸ” Linux File Permissions – Beginner Guide - -This document explains basic Linux file permissions and essential commands for beginners. - --------------------------------------------------- - -WHAT ARE FILE PERMISSIONS? - -Linux controls who can READ, WRITE, or EXECUTE a file or directory. - -User Types: -u β†’ Owner (user) -g β†’ Group -o β†’ Others - -Permission Types: -r β†’ Read -w β†’ Write -x β†’ Execute - --------------------------------------------------- - -VIEWING FILE PERMISSIONS - -Command: - ls -l - -Example Output: - -rw-r--r-- 1 user group 1234 Jan 1 file.txt - -### Permission Meaning - -```text --rw-r--r-- -β”‚ β”‚ β”‚ β”‚ -β”‚ β”‚ β”‚ └── Others permissions (r--) -β”‚ β”‚ └───── Group permissions (r--) -β”‚ └──────── Owner permissions (rw-) -└────────── File type (-) -``` - --------------------------------------------------- - -FILE TYPES - -- Regular file -d Directory -l Symbolic link - --------------------------------------------------- - -PERMISSION VALUES - -Read (r) = 4 -Write (w) = 2 -Execute (x) = 1 - -Examples: -rwx = 4 + 2 + 1 = 7 -rw- = 4 + 2 = 6 -r-x = 4 + 1 = 5 -r-- = 4 = 4 - --------------------------------------------------- - -CHANGING PERMISSIONS (chmod) - -Symbolic Method: - chmod u+x file.sh - chmod g+w file.txt - chmod o-r file.txt - chmod u=rwx script.sh - -Symbols: -+ Add permission -- Remove permission -= Set exact permission - --------------------------------------------------- - -NUMERIC METHOD (Beginner Friendly) - - chmod 644 file.txt - chmod 755 script.sh - chmod 700 private.sh - -Meaning: -7 = rwx -6 = rw- -5 = r-x -4 = r-- - --------------------------------------------------- - -MAKING A FILE EXECUTABLE - - chmod +x script.sh - ./script.sh - --------------------------------------------------- - -CHANGING FILE OWNER (chown) - -Change owner: - chown username file.txt - -Change owner and group: - chown username:groupname file.txt - --------------------------------------------------- - -IMPORTANT BEGINNER NOTES - -- Directories require EXECUTE (x) permission to open -- Avoid using chmod 777 -- Always check permissions using ls -l -- Practice in a test directory - --------------------------------------------------- - -QUICK COMMAND SUMMARY - -ls -l β†’ View permissions -chmod β†’ Change permissions -chmod +x β†’ Make executable -chown β†’ Change owner - --------------------------------------------------- - -Happy Learning 🐧 +# πŸ” Linux File Permissions – Beginner Guide + +This document explains basic Linux file permissions and essential commands for beginners. + +-------------------------------------------------- + +WHAT ARE FILE PERMISSIONS? + +Linux controls who can READ, WRITE, or EXECUTE a file or directory. + +User Types: +u β†’ Owner (user) +g β†’ Group +o β†’ Others + +Permission Types: +r β†’ Read +w β†’ Write +x β†’ Execute + +-------------------------------------------------- + +VIEWING FILE PERMISSIONS + +Command: + ls -l + +Example Output: + -rw-r--r-- 1 user group 1234 Jan 1 file.txt + +### Permission Meaning + +```text +-rw-r--r-- +β”‚ β”‚ β”‚ β”‚ +β”‚ β”‚ β”‚ └── Others permissions (r--) +β”‚ β”‚ └───── Group permissions (r--) +β”‚ └──────── Owner permissions (rw-) +└────────── File type (-) +``` + +-------------------------------------------------- + +FILE TYPES + +- Regular file +d Directory +l Symbolic link + +-------------------------------------------------- + +PERMISSION VALUES + +Read (r) = 4 +Write (w) = 2 +Execute (x) = 1 + +Examples: +rwx = 4 + 2 + 1 = 7 +rw- = 4 + 2 = 6 +r-x = 4 + 1 = 5 +r-- = 4 = 4 + +-------------------------------------------------- + +CHANGING PERMISSIONS (chmod) + +Symbolic Method: + chmod u+x file.sh + chmod g+w file.txt + chmod o-r file.txt + chmod u=rwx script.sh + +Symbols: ++ Add permission +- Remove permission += Set exact permission + +-------------------------------------------------- + +NUMERIC METHOD (Beginner Friendly) + + chmod 644 file.txt + chmod 755 script.sh + chmod 700 private.sh + +Meaning: +7 = rwx +6 = rw- +5 = r-x +4 = r-- + +-------------------------------------------------- + +MAKING A FILE EXECUTABLE + + chmod +x script.sh + ./script.sh + +-------------------------------------------------- + +CHANGING FILE OWNER (chown) + +Change owner: + chown username file.txt + +Change owner and group: + chown username:groupname file.txt + +-------------------------------------------------- + +IMPORTANT BEGINNER NOTES + +- Directories require EXECUTE (x) permission to open +- Avoid using chmod 777 +- Always check permissions using ls -l +- Practice in a test directory + +-------------------------------------------------- + +QUICK COMMAND SUMMARY + +ls -l β†’ View permissions +chmod β†’ Change permissions +chmod +x β†’ Make executable +chown β†’ Change owner + +-------------------------------------------------- + +Happy Learning 🐧 diff --git a/level-0-linux/concepts/commands.md b/level-0-linux/concepts/commands.md index bba1d13..f2ddefd 100644 --- a/level-0-linux/concepts/commands.md +++ b/level-0-linux/concepts/commands.md @@ -1,108 +1,108 @@ -Basic Linux Commands - -This reference covers fundamental Linux commands for navigating the file system and managing files. - -ls - -Lists files and directories in the current directory. - -Example: - -ls -l - - -Sample Output: - -drwxr-xr-x 2 user group 4096 Jan 01 12:00 Desktop --rw-r--r-- 1 user group 123 Jan 01 12:05 file.txt - - -pwd - -Prints the path of the current working directory. - -Example: - -pwd - - -Sample Output: - -/home/username/projects - - -cd - -Changes the current directory to the specified path. - -Example: - -cd /var/log - - -mkdir - -Creates a new directory (folder). - -Example: - -mkdir new_project - - -rmdir - -Removes an empty directory. Note: It will fail if the directory contains files. - -Example: - -rmdir old_project - - -cp - -Copies files or directories from a source to a destination. - -Example: - -cp file.txt backup/file_backup.txt - - -mv - -Moves a file or directory to a new location, or renames it. - -Example: - -mv old_name.txt new_name.txt - - -rm - -Removes (deletes) files. Use with caution as this cannot be easily undone. - -Example: - -rm junk_file.txt - - -cat - -Reads a file and outputs its content to the terminal. - -Example: - -cat /etc/hostname - - -Sample Output: - -my-server-01 - - -touch - -Creates an empty file if it doesn't exist, or updates the timestamp of an existing file. - -Example: - -touch new_script.sh +Basic Linux Commands + +This reference covers fundamental Linux commands for navigating the file system and managing files. + +ls + +Lists files and directories in the current directory. + +Example: + +ls -l + + +Sample Output: + +drwxr-xr-x 2 user group 4096 Jan 01 12:00 Desktop +-rw-r--r-- 1 user group 123 Jan 01 12:05 file.txt + + +pwd + +Prints the path of the current working directory. + +Example: + +pwd + + +Sample Output: + +/home/username/projects + + +cd + +Changes the current directory to the specified path. + +Example: + +cd /var/log + + +mkdir + +Creates a new directory (folder). + +Example: + +mkdir new_project + + +rmdir + +Removes an empty directory. Note: It will fail if the directory contains files. + +Example: + +rmdir old_project + + +cp + +Copies files or directories from a source to a destination. + +Example: + +cp file.txt backup/file_backup.txt + + +mv + +Moves a file or directory to a new location, or renames it. + +Example: + +mv old_name.txt new_name.txt + + +rm + +Removes (deletes) files. Use with caution as this cannot be easily undone. + +Example: + +rm junk_file.txt + + +cat + +Reads a file and outputs its content to the terminal. + +Example: + +cat /etc/hostname + + +Sample Output: + +my-server-01 + + +touch + +Creates an empty file if it doesn't exist, or updates the timestamp of an existing file. + +Example: + +touch new_script.sh diff --git a/level-0-linux/tasks/log-cleaner-backup/Readme.md b/level-0-linux/tasks/log-cleaner-backup/Readme.md index 4caab14..8b4784f 100644 --- a/level-0-linux/tasks/log-cleaner-backup/Readme.md +++ b/level-0-linux/tasks/log-cleaner-backup/Readme.md @@ -1,24 +1,24 @@ -# Automated Log Cleaner & Backup - -A Bash script that automatically finds old log files, compresses them, backs them up, and removes them to free disk space. - -## Features -- Finds log files older than specified days -- Compresses logs into tar.gz -- Deletes original logs after backup -- Safe and cron-friendly - -## Requirements -- Linux -- Bash - -## Configuration -Edit variables inside `log_cleaner.sh`: -- LOG_DIR -- DAYS_OLD -- BACKUP_DIR - -## Usage -```bash -chmod +x log_cleaner.sh -./log_cleaner.sh +# Automated Log Cleaner & Backup + +A Bash script that automatically finds old log files, compresses them, backs them up, and removes them to free disk space. + +## Features +- Finds log files older than specified days +- Compresses logs into tar.gz +- Deletes original logs after backup +- Safe and cron-friendly + +## Requirements +- Linux +- Bash + +## Configuration +Edit variables inside `log_cleaner.sh`: +- LOG_DIR +- DAYS_OLD +- BACKUP_DIR + +## Usage +```bash +chmod +x log_cleaner.sh +./log_cleaner.sh diff --git a/level-0-linux/tasks/log-cleaner-backup/log_cleaner.sh b/level-0-linux/tasks/log-cleaner-backup/log_cleaner.sh index b8527ca..dc0901b 100644 --- a/level-0-linux/tasks/log-cleaner-backup/log_cleaner.sh +++ b/level-0-linux/tasks/log-cleaner-backup/log_cleaner.sh @@ -1,32 +1,32 @@ -#!/bin/bash - -# Config -LOG_DIR="/var/log" -BACKUP_DIR="$PWD/backups" -DAYS_OLD=7 -TIMESTAMP=$(date +"%Y%m%d_%H%M%S") - -mkdir -p "$BACKUP_DIR" - -echo "Starting log cleanup at $TIMESTAMP" - -# Find old log files -old_logs=$(find "$LOG_DIR" -type f -name "*.log" -mtime +$DAYS_OLD 2>/dev/null) - -if [ -z "$old_logs" ]; then - echo "No old log files found." - exit 0 -fi - -ARCHIVE_NAME="logs_backup_$TIMESTAMP.tar.gz" - -# Compress logs -tar -czf "$BACKUP_DIR/$ARCHIVE_NAME" $old_logs 2>/dev/null - -# Delete original logs -for log in $old_logs; do - rm -f "$log" -done - -echo "Backup created: $BACKUP_DIR/$ARCHIVE_NAME" -echo "Old logs cleaned successfully." +#!/bin/bash + +# Config +LOG_DIR="/var/log" +BACKUP_DIR="$PWD/backups" +DAYS_OLD=7 +TIMESTAMP=$(date +"%Y%m%d_%H%M%S") + +mkdir -p "$BACKUP_DIR" + +echo "Starting log cleanup at $TIMESTAMP" + +# Find old log files +old_logs=$(find "$LOG_DIR" -type f -name "*.log" -mtime +$DAYS_OLD 2>/dev/null) + +if [ -z "$old_logs" ]; then + echo "No old log files found." + exit 0 +fi + +ARCHIVE_NAME="logs_backup_$TIMESTAMP.tar.gz" + +# Compress logs +tar -czf "$BACKUP_DIR/$ARCHIVE_NAME" "$old_logs" 2>/dev/null + +# Delete original logs +for log in $old_logs; do + rm -f "$log" +done + +echo "Backup created: $BACKUP_DIR/$ARCHIVE_NAME" +echo "Old logs cleaned successfully." diff --git a/level-0-linux/tasks/system-health-auditor/readme.md b/level-0-linux/tasks/system-health-auditor/readme.md index e7de7be..ead8045 100644 --- a/level-0-linux/tasks/system-health-auditor/readme.md +++ b/level-0-linux/tasks/system-health-auditor/readme.md @@ -1,182 +1,182 @@ -# System Health Auditor - -A Bash-based system health reporting tool that collects various Linux system metrics and prints them in a structured, human-readable format. -It helps you inspect core system information like uptime, resource usage, process count, open ports, and recent critical errors. - -This project is part of the **Linux CLI Projects** in the DevOps portfolio. - ---- - -## πŸ“Œ Overview - -**System Health Auditor** is a shell script that runs on Linux systems and displays the system’s health information directly in the terminal. -It uses standard Linux utilities to gather data about processes, memory, storage, networking, and errors. - ---- - -## 🧠 What It Reports - -The script prints: - -- Date & time -- Hostname -- System uptime -- Top CPU-consuming processes -- Memory usage -- Disk usage -- Running processes count -- Open/listening ports -- Recent critical system errors (via `journalctl`, requires root) - ---- - -## πŸ“¦ Technologies Used - -This script uses: - -- Bash shell -- Common Linux command-line utilities (`ps`, `free`, `df`, `ss`, `journalctl`, etc.) - ---- - -## πŸ“ Repository Structure - -# System Health Auditor - -A Bash-based system health reporting tool that collects various Linux system metrics and prints them in a structured, human-readable format. -It helps you inspect core system information like uptime, resource usage, process count, open ports, and recent critical errors. - -This project is part of the **Linux CLI Projects** in the DevOps portfolio. - ---- - -## πŸ“Œ Overview - -**System Health Auditor** is a shell script that runs on Linux systems and displays the system’s health information directly in the terminal. -It uses standard Linux utilities to gather data about processes, memory, storage, networking, and errors. - ---- - -## 🧠 What It Reports - -The script prints: - -- Date & time -- Hostname -- System uptime -- Top CPU-consuming processes -- Memory usage -- Disk usage -- Running processes count -- Open/listening ports -- Recent critical system errors (via `journalctl`, requires root) - ---- - -## πŸ“¦ Technologies Used - -This script uses: - -- Bash shell -- Common Linux command-line utilities (`ps`, `free`, `df`, `ss`, `journalctl`, etc.) - ---- - -## πŸ“ Repository Structure - -linux-cli-projects/ -└── system-health-auditor/ -β”œβ”€β”€ system_health.sh # Main script -└── README.md # This documentation - - ---- - -## πŸ›  Prerequisites - -- Linux OS (Ubuntu/Debian/CentOS or other systemd-based distro) -- Bash shell -- `systemd` / `journalctl` (for error logs) -- Execute permission for the script - -> πŸ” To view recent system errors, run the script with `sudo` because `journalctl` requires elevated privileges. - ---- - -## πŸš€ Installation & Setup - -### 1. Clone the repo - -```bash -git clone https://github.com/iamdevdhanush/Devops.git -cd Devops/linux-cli-projects/system-health-auditor -``` - -2. Make the script executable - -chmod +x system_health.sh - -β–Ά Usage - -Run the script: - -./system_health.sh - - -To include system error logs (requires root): - -sudo ./system_health.sh - -πŸ“Š Example Output -=============================== - SYSTEM HEALTH REPORT -=============================== - -Date & Time: -Mon Jan 5 15:42:10 IST 2026 - -Hostname: -server01 - -Uptime: -up 3 hours, 42 minutes - --------------------------------- -CPU USAGE --------------------------------- -PID COMMAND %CPU -1023 nginx 11.9 -2154 python 9.3 - --------------------------------- -MEMORY USAGE --------------------------------- - total used free -Mem: 7.8G 3.2G 2.5G - --------------------------------- -DISK USAGE --------------------------------- -Filesystem Size Used Avail Use% -/dev/sda1 50G 29G 18G 62% - --------------------------------- -RUNNING PROCESSES COUNT --------------------------------- -145 - --------------------------------- -OPEN PORTS --------------------------------- -LISTEN 0 128 *:22 *:* -LISTEN 0 128 *:80 *:* - --------------------------------- -RECENT SYSTEM ERRORS --------------------------------- -Jan 05 15:33:12 hostname systemd[1]: Failed to start SomeService -... - - -(The actual output varies by system and load.) - +# System Health Auditor + +A Bash-based system health reporting tool that collects various Linux system metrics and prints them in a structured, human-readable format. +It helps you inspect core system information like uptime, resource usage, process count, open ports, and recent critical errors. + +This project is part of the **Linux CLI Projects** in the DevOps portfolio. + +--- + +## πŸ“Œ Overview + +**System Health Auditor** is a shell script that runs on Linux systems and displays the system’s health information directly in the terminal. +It uses standard Linux utilities to gather data about processes, memory, storage, networking, and errors. + +--- + +## 🧠 What It Reports + +The script prints: + +- Date & time +- Hostname +- System uptime +- Top CPU-consuming processes +- Memory usage +- Disk usage +- Running processes count +- Open/listening ports +- Recent critical system errors (via `journalctl`, requires root) + +--- + +## πŸ“¦ Technologies Used + +This script uses: + +- Bash shell +- Common Linux command-line utilities (`ps`, `free`, `df`, `ss`, `journalctl`, etc.) + +--- + +## πŸ“ Repository Structure + +# System Health Auditor + +A Bash-based system health reporting tool that collects various Linux system metrics and prints them in a structured, human-readable format. +It helps you inspect core system information like uptime, resource usage, process count, open ports, and recent critical errors. + +This project is part of the **Linux CLI Projects** in the DevOps portfolio. + +--- + +## πŸ“Œ Overview + +**System Health Auditor** is a shell script that runs on Linux systems and displays the system’s health information directly in the terminal. +It uses standard Linux utilities to gather data about processes, memory, storage, networking, and errors. + +--- + +## 🧠 What It Reports + +The script prints: + +- Date & time +- Hostname +- System uptime +- Top CPU-consuming processes +- Memory usage +- Disk usage +- Running processes count +- Open/listening ports +- Recent critical system errors (via `journalctl`, requires root) + +--- + +## πŸ“¦ Technologies Used + +This script uses: + +- Bash shell +- Common Linux command-line utilities (`ps`, `free`, `df`, `ss`, `journalctl`, etc.) + +--- + +## πŸ“ Repository Structure + +linux-cli-projects/ +└── system-health-auditor/ +β”œβ”€β”€ system_health.sh # Main script +└── README.md # This documentation + + +--- + +## πŸ›  Prerequisites + +- Linux OS (Ubuntu/Debian/CentOS or other systemd-based distro) +- Bash shell +- `systemd` / `journalctl` (for error logs) +- Execute permission for the script + +> πŸ” To view recent system errors, run the script with `sudo` because `journalctl` requires elevated privileges. + +--- + +## πŸš€ Installation & Setup + +### 1. Clone the repo + +```bash +git clone https://github.com/iamdevdhanush/Devops.git +cd Devops/linux-cli-projects/system-health-auditor +``` + +2. Make the script executable + +chmod +x system_health.sh + +β–Ά Usage + +Run the script: + +./system_health.sh + + +To include system error logs (requires root): + +sudo ./system_health.sh + +πŸ“Š Example Output +=============================== + SYSTEM HEALTH REPORT +=============================== + +Date & Time: +Mon Jan 5 15:42:10 IST 2026 + +Hostname: +server01 + +Uptime: +up 3 hours, 42 minutes + +-------------------------------- +CPU USAGE +-------------------------------- +PID COMMAND %CPU +1023 nginx 11.9 +2154 python 9.3 + +-------------------------------- +MEMORY USAGE +-------------------------------- + total used free +Mem: 7.8G 3.2G 2.5G + +-------------------------------- +DISK USAGE +-------------------------------- +Filesystem Size Used Avail Use% +/dev/sda1 50G 29G 18G 62% + +-------------------------------- +RUNNING PROCESSES COUNT +-------------------------------- +145 + +-------------------------------- +OPEN PORTS +-------------------------------- +LISTEN 0 128 *:22 *:* +LISTEN 0 128 *:80 *:* + +-------------------------------- +RECENT SYSTEM ERRORS +-------------------------------- +Jan 05 15:33:12 hostname systemd[1]: Failed to start SomeService +... + + +(The actual output varies by system and load.) + diff --git a/level-0-linux/tasks/system-health-auditor/system_audit.sh b/level-0-linux/tasks/system-health-auditor/system_audit.sh old mode 100755 new mode 100644 diff --git a/level-1-shell-scripting/README.md b/level-1-shell-scripting/README.md index 4ebe1fd..9c618b3 100644 --- a/level-1-shell-scripting/README.md +++ b/level-1-shell-scripting/README.md @@ -1,50 +1,50 @@ -# Level 1: Shell Scripting - -## πŸ“Œ Objective -Learn how to automate tasks using Bash shell scripting with real-world DevOps examples. - ---- - -## 🧠 What You Will Learn -- Core concepts related to this level -- Hands-on practical skills -- Real-world DevOps use cases - ---- - -## πŸ“‚ Folder Structure -- `concepts/` or `basics/` β†’ Theory and explanations -- `tasks/` or `projects/` β†’ Hands-on exercises -- `solutions/` β†’ Reference implementations (optional) - ---- - -## βœ… Prerequisites -- Basic Linux knowledge -- Willingness to practice (not just read) - ---- - -## πŸ§ͺ How to Use This Level -1. Read the concepts -2. Complete the tasks -3. Try projects without looking at solutions -4. Compare with solutions only after attempting - ---- - -## 🀝 Contribution Guidelines -You can contribute by: -- Adding tasks -- Improving explanations -- Fixing mistakes -- Adding real-world examples - -Follow the main `CONTRIBUTING.md` rules. - ---- - -## πŸš€ Progression -Complete this level before moving to the next one in the roadmap. - -Happy Learning & Building πŸ› οΈ +# Level 1: Shell Scripting + +## πŸ“Œ Objective +Learn how to automate tasks using Bash shell scripting with real-world DevOps examples. + +--- + +## 🧠 What You Will Learn +- Core concepts related to this level +- Hands-on practical skills +- Real-world DevOps use cases + +--- + +## πŸ“‚ Folder Structure +- `concepts/` or `basics/` β†’ Theory and explanations +- `tasks/` or `projects/` β†’ Hands-on exercises +- `solutions/` β†’ Reference implementations (optional) + +--- + +## βœ… Prerequisites +- Basic Linux knowledge +- Willingness to practice (not just read) + +--- + +## πŸ§ͺ How to Use This Level +1. Read the concepts +2. Complete the tasks +3. Try projects without looking at solutions +4. Compare with solutions only after attempting + +--- + +## 🀝 Contribution Guidelines +You can contribute by: +- Adding tasks +- Improving explanations +- Fixing mistakes +- Adding real-world examples + +Follow the main `CONTRIBUTING.md` rules. + +--- + +## πŸš€ Progression +Complete this level before moving to the next one in the roadmap. + +Happy Learning & Building πŸ› οΈ diff --git a/level-1-shell-scripting/basics/basics/README.md b/level-1-shell-scripting/basics/basics/README.md index dea3090..1907370 100644 --- a/level-1-shell-scripting/basics/basics/README.md +++ b/level-1-shell-scripting/basics/basics/README.md @@ -1,129 +1,129 @@ -# Basic Shell Scripting Examples - -This folder contains **basic Bash shell scripting examples** for beginners. -Each script demonstrates a core concept commonly used in shell scripting. - ---- - -## Prerequisites - -* Linux / macOS terminal (or Git Bash / WSL on Windows) -* Bash shell -* Basic terminal knowledge (`cd`, `ls`) - -Make scripts executable (optional): - -```bash -chmod +x *.sh -``` - ---- - -## Scripts Overview - -### 1️⃣ `variables.sh` - -**What it demonstrates** - -* How to declare and use variables in Bash - -**How to run** - -```bash -bash variables.sh -``` - -**What you should learn** - -* Variable assignment syntax -* How to reference variables using `$` -* Difference between strings and variables - ---- - -### 2️⃣ `echo.sh` - -**What it demonstrates** - -* Printing output to the terminal using `echo` - -**How to run** - -```bash -bash echo.sh -``` - -**What you should learn** - -* How to display text -* How to print variables -* Basic output formatting - ---- - -### 3️⃣ `if_else.sh` - -**What it demonstrates** - -* Conditional logic using `if`, `else` - -**How to run** - -```bash -bash if_else.sh -``` - -**What you should learn** - -* How conditions work in Bash -* Using comparison operators -* Controlling script flow based on conditions - ---- - -### 4️⃣ `loops.sh` - -**What it demonstrates** - -* Looping with `for` (and/or `while`) - -**How to run** - -```bash -bash loops.sh -``` - -**What you should learn** - -* Repeating commands using loops -* Iterating over values -* Automating repetitive tasks - ---- - -### 5️⃣ `hello.sh` - -**What it demonstrates** - -* A simple end-to-end Bash script - -**How to run** - -```bash -bash hello.sh -``` - -**What you should learn** - -* Basic script structure -* Using `echo` -* Running a shell script from the terminal - ---- - -## Notes - -* These examples are intentionally simple for learning purposes. -* Try editing the scripts and re-running them to better understand how Bash works. - -Happy scripting! πŸš€ +# Basic Shell Scripting Examples + +This folder contains **basic Bash shell scripting examples** for beginners. +Each script demonstrates a core concept commonly used in shell scripting. + +--- + +## Prerequisites + +* Linux / macOS terminal (or Git Bash / WSL on Windows) +* Bash shell +* Basic terminal knowledge (`cd`, `ls`) + +Make scripts executable (optional): + +```bash +chmod +x *.sh +``` + +--- + +## Scripts Overview + +### 1️⃣ `variables.sh` + +**What it demonstrates** + +* How to declare and use variables in Bash + +**How to run** + +```bash +bash variables.sh +``` + +**What you should learn** + +* Variable assignment syntax +* How to reference variables using `$` +* Difference between strings and variables + +--- + +### 2️⃣ `echo.sh` + +**What it demonstrates** + +* Printing output to the terminal using `echo` + +**How to run** + +```bash +bash echo.sh +``` + +**What you should learn** + +* How to display text +* How to print variables +* Basic output formatting + +--- + +### 3️⃣ `if_else.sh` + +**What it demonstrates** + +* Conditional logic using `if`, `else` + +**How to run** + +```bash +bash if_else.sh +``` + +**What you should learn** + +* How conditions work in Bash +* Using comparison operators +* Controlling script flow based on conditions + +--- + +### 4️⃣ `loops.sh` + +**What it demonstrates** + +* Looping with `for` (and/or `while`) + +**How to run** + +```bash +bash loops.sh +``` + +**What you should learn** + +* Repeating commands using loops +* Iterating over values +* Automating repetitive tasks + +--- + +### 5️⃣ `hello.sh` + +**What it demonstrates** + +* A simple end-to-end Bash script + +**How to run** + +```bash +bash hello.sh +``` + +**What you should learn** + +* Basic script structure +* Using `echo` +* Running a shell script from the terminal + +--- + +## Notes + +* These examples are intentionally simple for learning purposes. +* Try editing the scripts and re-running them to better understand how Bash works. + +Happy scripting! πŸš€ diff --git a/level-1-shell-scripting/basics/basics/echo.sh b/level-1-shell-scripting/basics/basics/echo.sh index 4f601bf..ec4603a 100644 --- a/level-1-shell-scripting/basics/basics/echo.sh +++ b/level-1-shell-scripting/basics/basics/echo.sh @@ -1,3 +1,4 @@ #!/bin/bash echo "Hello, World" +name="John" echo "My name is $name" diff --git a/level-1-shell-scripting/basics/basics/hello.sh b/level-1-shell-scripting/basics/basics/hello.sh old mode 100755 new mode 100644 diff --git a/level-1-shell-scripting/basics/basics/loops.sh b/level-1-shell-scripting/basics/basics/loops.sh index c833368..f10727e 100644 --- a/level-1-shell-scripting/basics/basics/loops.sh +++ b/level-1-shell-scripting/basics/basics/loops.sh @@ -1,4 +1,3 @@ - #!/bin/bash for i in 1 2 3 4 5 do diff --git a/level-1-shell-scripting/basics/intermediate/backup-script.sh b/level-1-shell-scripting/basics/intermediate/backup-script.sh index e69de29..a9bf588 100644 --- a/level-1-shell-scripting/basics/intermediate/backup-script.sh +++ b/level-1-shell-scripting/basics/intermediate/backup-script.sh @@ -0,0 +1 @@ +#!/bin/bash diff --git a/level-2-git-github/README.md b/level-2-git-github/README.md index 2b8c399..83bf01b 100644 --- a/level-2-git-github/README.md +++ b/level-2-git-github/README.md @@ -1,50 +1,50 @@ -# Level 2: Git & GitHub - -## πŸ“Œ Objective -Understand version control, collaboration workflows, and open-source contribution using Git and GitHub. - ---- - -## 🧠 What You Will Learn -- Core concepts related to this level -- Hands-on practical skills -- Real-world DevOps use cases - ---- - -## πŸ“‚ Folder Structure -- `concepts/` or `basics/` β†’ Theory and explanations -- `tasks/` or `projects/` β†’ Hands-on exercises -- `solutions/` β†’ Reference implementations (optional) - ---- - -## βœ… Prerequisites -- Basic Linux knowledge -- Willingness to practice (not just read) - ---- - -## πŸ§ͺ How to Use This Level -1. Read the concepts -2. Complete the tasks -3. Try projects without looking at solutions -4. Compare with solutions only after attempting - ---- - -## 🀝 Contribution Guidelines -You can contribute by: -- Adding tasks -- Improving explanations -- Fixing mistakes -- Adding real-world examples - -Follow the main `CONTRIBUTING.md` rules. - ---- - -## πŸš€ Progression -Complete this level before moving to the next one in the roadmap. - -Happy Learning & Building πŸ› οΈ +# Level 2: Git & GitHub + +## πŸ“Œ Objective +Understand version control, collaboration workflows, and open-source contribution using Git and GitHub. + +--- + +## 🧠 What You Will Learn +- Core concepts related to this level +- Hands-on practical skills +- Real-world DevOps use cases + +--- + +## πŸ“‚ Folder Structure +- `concepts/` or `basics/` β†’ Theory and explanations +- `tasks/` or `projects/` β†’ Hands-on exercises +- `solutions/` β†’ Reference implementations (optional) + +--- + +## βœ… Prerequisites +- Basic Linux knowledge +- Willingness to practice (not just read) + +--- + +## πŸ§ͺ How to Use This Level +1. Read the concepts +2. Complete the tasks +3. Try projects without looking at solutions +4. Compare with solutions only after attempting + +--- + +## 🀝 Contribution Guidelines +You can contribute by: +- Adding tasks +- Improving explanations +- Fixing mistakes +- Adding real-world examples + +Follow the main `CONTRIBUTING.md` rules. + +--- + +## πŸš€ Progression +Complete this level before moving to the next one in the roadmap. + +Happy Learning & Building πŸ› οΈ diff --git a/level-2-git-github/basics/README.md b/level-2-git-github/basics/README.md index 793a727..a8a466b 100644 --- a/level-2-git-github/basics/README.md +++ b/level-2-git-github/basics/README.md @@ -1,158 +1,158 @@ -#!/bin/bash - -######################################################## -# πŸš€ GIT & GITHUB – LEVEL 1 (BEGINNER) -# This script explains basic Git + GitHub workflow -# You can read, copy, and execute commands step by step -######################################################## - - -############################ -# 1️⃣ CHECK GIT INSTALLATION -############################ -git --version -# If not installed (Ubuntu): -# sudo apt install git -y - - -############################ -# 2️⃣ CONFIGURE GIT (ONE TIME) -############################ -git config --global user.name "Your Name" -git config --global user.email "your-email@gmail.com" - -# Verify config -git config --list - - -############################ -# 3️⃣ CREATE A PROJECT FOLDER -############################ -mkdir Devops -cd Devops - - -############################ -# 4️⃣ INITIALIZE GIT REPO -############################ -git init -# Creates .git folder (Git starts tracking) - - -############################ -# 5️⃣ CREATE A FILE -############################ -echo "Hello DevOps" > README.md -ls - - -############################ -# 6️⃣ CHECK GIT STATUS -############################ -git status -# Shows untracked / modified files - - -############################ -# 7️⃣ ADD FILES TO STAGING AREA -############################ -git add README.md -# OR add all files: -# git add . - - -############################ -# 8️⃣ COMMIT CHANGES -############################ -git commit -m "Initial commit" -# Saves snapshot to local repo - - -############################ -# 9️⃣ CREATE GITHUB REPOSITORY -############################ -# Go to GitHub β†’ New Repository β†’ Create repo (NO README) -# Copy the repo URL - - -############################ -# πŸ”Ÿ ADD REMOTE ORIGIN -############################ -git remote add origin https://github.com/username/Devops.git - -# Verify remote -git remote -v - - -############################ -# 1️⃣1️⃣ PUSH CODE TO GITHUB -############################ -git branch -M main -git push -u origin main - - -############################ -# 1️⃣2️⃣ CLONE A REPOSITORY -############################ -# git clone https://github.com/username/Devops.git - - -############################ -# 1️⃣3️⃣ CREATE A NEW BRANCH -############################ -git checkout -b feature-shell-script -# OR -# git branch feature-shell-script -# git checkout feature-shell-script - - -############################ -# 1️⃣4️⃣ MAKE CHANGES IN BRANCH -############################ -echo "Shell scripting basics" >> README.md -git add . -git commit -m "Added shell scripting info" - - -############################ -# 1️⃣5️⃣ PUSH BRANCH TO GITHUB -############################ -git push origin feature-shell-script - - -############################ -# 1️⃣6️⃣ CREATE PULL REQUEST (PR) -############################ -# Go to GitHub β†’ Compare & Pull Request -# Add title and description β†’ Create PR - - -############################ -# 1️⃣7️⃣ PULL LATEST CHANGES -############################ -git checkout main -git pull origin main - - -############################ -# 1️⃣8️⃣ GIT LOG (HISTORY) -############################ -git log --oneline - - -############################ -# 1️⃣9️⃣ GIT DIFF (CHANGES) -############################ -git diff - - -############################ -# 2️⃣0️⃣ DELETE A BRANCH -############################ -git branch -d feature-shell-script -git push origin --delete feature-shell-script - - -######################################################## -# βœ… END OF GIT & GITHUB LEVEL 1 -######################################################## +#!/bin/bash + +######################################################## +# πŸš€ GIT & GITHUB – LEVEL 1 (BEGINNER) +# This script explains basic Git + GitHub workflow +# You can read, copy, and execute commands step by step +######################################################## + + +############################ +# 1️⃣ CHECK GIT INSTALLATION +############################ +git --version +# If not installed (Ubuntu): +# sudo apt install git -y + + +############################ +# 2️⃣ CONFIGURE GIT (ONE TIME) +############################ +git config --global user.name "Your Name" +git config --global user.email "your-email@gmail.com" + +# Verify config +git config --list + + +############################ +# 3️⃣ CREATE A PROJECT FOLDER +############################ +mkdir Devops +cd Devops + + +############################ +# 4️⃣ INITIALIZE GIT REPO +############################ +git init +# Creates .git folder (Git starts tracking) + + +############################ +# 5️⃣ CREATE A FILE +############################ +echo "Hello DevOps" > README.md +ls + + +############################ +# 6️⃣ CHECK GIT STATUS +############################ +git status +# Shows untracked / modified files + + +############################ +# 7️⃣ ADD FILES TO STAGING AREA +############################ +git add README.md +# OR add all files: +# git add . + + +############################ +# 8️⃣ COMMIT CHANGES +############################ +git commit -m "Initial commit" +# Saves snapshot to local repo + + +############################ +# 9️⃣ CREATE GITHUB REPOSITORY +############################ +# Go to GitHub β†’ New Repository β†’ Create repo (NO README) +# Copy the repo URL + + +############################ +# πŸ”Ÿ ADD REMOTE ORIGIN +############################ +git remote add origin https://github.com/username/Devops.git + +# Verify remote +git remote -v + + +############################ +# 1️⃣1️⃣ PUSH CODE TO GITHUB +############################ +git branch -M main +git push -u origin main + + +############################ +# 1️⃣2️⃣ CLONE A REPOSITORY +############################ +# git clone https://github.com/username/Devops.git + + +############################ +# 1️⃣3️⃣ CREATE A NEW BRANCH +############################ +git checkout -b feature-shell-script +# OR +# git branch feature-shell-script +# git checkout feature-shell-script + + +############################ +# 1️⃣4️⃣ MAKE CHANGES IN BRANCH +############################ +echo "Shell scripting basics" >> README.md +git add . +git commit -m "Added shell scripting info" + + +############################ +# 1️⃣5️⃣ PUSH BRANCH TO GITHUB +############################ +git push origin feature-shell-script + + +############################ +# 1️⃣6️⃣ CREATE PULL REQUEST (PR) +############################ +# Go to GitHub β†’ Compare & Pull Request +# Add title and description β†’ Create PR + + +############################ +# 1️⃣7️⃣ PULL LATEST CHANGES +############################ +git checkout main +git pull origin main + + +############################ +# 1️⃣8️⃣ GIT LOG (HISTORY) +############################ +git log --oneline + + +############################ +# 1️⃣9️⃣ GIT DIFF (CHANGES) +############################ +git diff + + +############################ +# 2️⃣0️⃣ DELETE A BRANCH +############################ +git branch -d feature-shell-script +git push origin --delete feature-shell-script + + +######################################################## +# βœ… END OF GIT & GITHUB LEVEL 1 +######################################################## diff --git a/level-2-git-github/projects/project-1-git-workflow/README.md b/level-2-git-github/projects/project-1-git-workflow/README.md index 64692e1..0ed8bf8 100644 --- a/level-2-git-github/projects/project-1-git-workflow/README.md +++ b/level-2-git-github/projects/project-1-git-workflow/README.md @@ -1,147 +1,147 @@ -############################################################ -# Project 1: Git & GitHub Workflow (Beginner) -# Path: -# projects/git-github/project-1-git-workflow/README.md -############################################################ - - -############################ -# πŸ“Œ Project Objective -############################ -# Understand and practice the basic Git and GitHub workflow -# used in real-world DevOps and open-source projects. -# -# This project helps you learn: -# - Git (version control) -# - GitHub (remote repository) -# - Collaboration using Pull Requests - - -############################ -# 🧠 Skills You Will Learn -############################ -# - git init -# - git add & git commit -# - git branch & checkout -# - git push & pull -# - Creating Pull Requests using GitHub GUI - - -############################ -# πŸ› οΈ Prerequisites -############################ -# - Git installed on your system -# - GitHub account -# - Basic Linux command knowledge - - -############################ -# πŸ“‹ Project Tasks -############################ - - -############################ -# βœ… Task 1: Create Local Repository -############################ -mkdir git-workflow -cd git-workflow -git init - - -############################ -# βœ… Task 2: Create File and Commit -############################ -echo "My first Git project" > README.md -git add README.md -git commit -m "Initial commit" - - -############################ -# βœ… Task 3: Create GitHub Repository -############################ -# Steps (GUI): -# 1. Go to GitHub -# 2. Click New Repository -# 3. Repository name: git-workflow -# 4. Do NOT initialize with README -# 5. Click Create repository - - -############################ -# βœ… Task 4: Push Code to GitHub -############################ -git branch -M main -git remote add origin https://github.com//git-workflow.git -git push -u origin main - - -############################ -# βœ… Task 5: Create Feature Branch -############################ -git checkout -b feature-update-readme - - -############################ -# βœ… Task 6: Make Changes and Commit -############################ -echo "Learning Git branching" >> README.md -git add . -git commit -m "Update README with branch content" - - -############################ -# βœ… Task 7: Push Branch to GitHub -############################ -git push origin feature-update-readme - - -############################ -# βœ… Task 8: Create Pull Request (GUI) -############################ -# Steps: -# 1. Open GitHub repository -# 2. Click Compare & pull request -# 3. Add PR title and description -# 4. Click Create pull request - - -############################ -# βœ… Task 9: Merge Pull Request -############################ -# - Merge PR using GitHub UI -# - Delete branch after merge - - -############################ -# 🎯 Expected Outcome -############################ -# - Code successfully pushed to GitHub -# - Pull Request created and merged -# - Clear understanding of Git workflow - - -############################ -# 🌱 Real-World DevOps Use Case -############################ -# This workflow is used in: -# - CI/CD pipelines -# - Infrastructure as Code (IaC) -# - Team collaboration -# - Open-source contributions - - -############################ -# πŸ§ͺ Bonus Practice -############################ -# - Create another branch -# - Make conflicting changes -# - Practice resolving merge conflicts - - -############################ -# βœ… Project Status -############################ -# βœ” Beginner Friendly -# βœ” Hands-on -# βœ” DevOps Ready -############################################################ +############################################################ +# Project 1: Git & GitHub Workflow (Beginner) +# Path: +# projects/git-github/project-1-git-workflow/README.md +############################################################ + + +############################ +# πŸ“Œ Project Objective +############################ +# Understand and practice the basic Git and GitHub workflow +# used in real-world DevOps and open-source projects. +# +# This project helps you learn: +# - Git (version control) +# - GitHub (remote repository) +# - Collaboration using Pull Requests + + +############################ +# 🧠 Skills You Will Learn +############################ +# - git init +# - git add & git commit +# - git branch & checkout +# - git push & pull +# - Creating Pull Requests using GitHub GUI + + +############################ +# πŸ› οΈ Prerequisites +############################ +# - Git installed on your system +# - GitHub account +# - Basic Linux command knowledge + + +############################ +# πŸ“‹ Project Tasks +############################ + + +############################ +# βœ… Task 1: Create Local Repository +############################ +mkdir git-workflow +cd git-workflow +git init + + +############################ +# βœ… Task 2: Create File and Commit +############################ +echo "My first Git project" > README.md +git add README.md +git commit -m "Initial commit" + + +############################ +# βœ… Task 3: Create GitHub Repository +############################ +# Steps (GUI): +# 1. Go to GitHub +# 2. Click New Repository +# 3. Repository name: git-workflow +# 4. Do NOT initialize with README +# 5. Click Create repository + + +############################ +# βœ… Task 4: Push Code to GitHub +############################ +git branch -M main +git remote add origin https://github.com//git-workflow.git +git push -u origin main + + +############################ +# βœ… Task 5: Create Feature Branch +############################ +git checkout -b feature-update-readme + + +############################ +# βœ… Task 6: Make Changes and Commit +############################ +echo "Learning Git branching" >> README.md +git add . +git commit -m "Update README with branch content" + + +############################ +# βœ… Task 7: Push Branch to GitHub +############################ +git push origin feature-update-readme + + +############################ +# βœ… Task 8: Create Pull Request (GUI) +############################ +# Steps: +# 1. Open GitHub repository +# 2. Click Compare & pull request +# 3. Add PR title and description +# 4. Click Create pull request + + +############################ +# βœ… Task 9: Merge Pull Request +############################ +# - Merge PR using GitHub UI +# - Delete branch after merge + + +############################ +# 🎯 Expected Outcome +############################ +# - Code successfully pushed to GitHub +# - Pull Request created and merged +# - Clear understanding of Git workflow + + +############################ +# 🌱 Real-World DevOps Use Case +############################ +# This workflow is used in: +# - CI/CD pipelines +# - Infrastructure as Code (IaC) +# - Team collaboration +# - Open-source contributions + + +############################ +# πŸ§ͺ Bonus Practice +############################ +# - Create another branch +# - Make conflicting changes +# - Practice resolving merge conflicts + + +############################ +# βœ… Project Status +############################ +# βœ” Beginner Friendly +# βœ” Hands-on +# βœ” DevOps Ready +############################################################ diff --git a/level-3-docker/README.md b/level-3-docker/README.md index ab07a7c..7a9463a 100644 --- a/level-3-docker/README.md +++ b/level-3-docker/README.md @@ -1,50 +1,50 @@ -# Level 3: Docker - -## πŸ“Œ Objective -Learn containerization fundamentals, Dockerfiles, images, containers, and mini-projects. - ---- - -## 🧠 What You Will Learn -- Core concepts related to this level -- Hands-on practical skills -- Real-world DevOps use cases - ---- - -## πŸ“‚ Folder Structure -- `concepts/` or `basics/` β†’ Theory and explanations -- `tasks/` or `projects/` β†’ Hands-on exercises -- `solutions/` β†’ Reference implementations (optional) - ---- - -## βœ… Prerequisites -- Basic Linux knowledge -- Willingness to practice (not just read) - ---- - -## πŸ§ͺ How to Use This Level -1. Read the concepts -2. Complete the tasks -3. Try projects without looking at solutions -4. Compare with solutions only after attempting - ---- - -## 🀝 Contribution Guidelines -You can contribute by: -- Adding tasks -- Improving explanations -- Fixing mistakes -- Adding real-world examples - -Follow the main `CONTRIBUTING.md` rules. - ---- - -## πŸš€ Progression -Complete this level before moving to the next one in the roadmap. - -Happy Learning & Building πŸ› οΈ +# Level 3: Docker + +## πŸ“Œ Objective +Learn containerization fundamentals, Dockerfiles, images, containers, and mini-projects. + +--- + +## 🧠 What You Will Learn +- Core concepts related to this level +- Hands-on practical skills +- Real-world DevOps use cases + +--- + +## πŸ“‚ Folder Structure +- `concepts/` or `basics/` β†’ Theory and explanations +- `tasks/` or `projects/` β†’ Hands-on exercises +- `solutions/` β†’ Reference implementations (optional) + +--- + +## βœ… Prerequisites +- Basic Linux knowledge +- Willingness to practice (not just read) + +--- + +## πŸ§ͺ How to Use This Level +1. Read the concepts +2. Complete the tasks +3. Try projects without looking at solutions +4. Compare with solutions only after attempting + +--- + +## 🀝 Contribution Guidelines +You can contribute by: +- Adding tasks +- Improving explanations +- Fixing mistakes +- Adding real-world examples + +Follow the main `CONTRIBUTING.md` rules. + +--- + +## πŸš€ Progression +Complete this level before moving to the next one in the roadmap. + +Happy Learning & Building πŸ› οΈ diff --git a/level-3-docker/docker-basics/README.md b/level-3-docker/docker-basics/README.md index aeee9fe..c90b80b 100644 --- a/level-3-docker/docker-basics/README.md +++ b/level-3-docker/docker-basics/README.md @@ -1,53 +1,53 @@ -# Docker Hello-World Basics - -This directory contains a minimal example to introduce Docker container basics using a lightweight Alpine Linux image. - -## 1. What this Dockerfile does - -* **`FROM alpine:latest`**: Pulls the Alpine Linux image (approx. 5MB) from the Docker Hub to act as the base OS. -* **`CMD [...]`**: Defines the default command that runs when the container starts. Here, it simply prints a welcome message to the terminal. - -## 2. How to Build and Run - -### Step 1: Build the Image -Navigate to the `docker/basics/` directory and run the following command to package the Dockerfile into an image named `hello-docker`: - -```bash -docker build -t hello-docker -``` -### Step 2: Run the Container -Once the build is complete, run an instance of the image: -```bash -docker run hello-docker -``` -### Expected Output
-You should see the following message in your terminal: -```Plaintext -Hello, World! Welcome to your first Docker container. -``` -### 3. Useful Commands -Here are some commands to help you manage what you just created.
-**List Images**
-Check which images currently exist on your machine. You should see hello-docker in this list. - -```Bash -docker images -``` -**Check Container Status**
-Since our container runs a simple echo command, it exits immediately after finishing. To see it, you must use the -a (all) flag to list stopped containers. -```Bash -# List only running containers (won't show our hello-world) -docker ps -# List ALL containers (including stopped ones) -docker ps -a -``` -**Clean Up**
-To delete the specific container and image we created: -1. Remove the stopped container -```Bash -docker rm -``` -2. Remove the image -``` -docker rmi hello-docker -``` +# Docker Hello-World Basics + +This directory contains a minimal example to introduce Docker container basics using a lightweight Alpine Linux image. + +## 1. What this Dockerfile does + +* **`FROM alpine:latest`**: Pulls the Alpine Linux image (approx. 5MB) from the Docker Hub to act as the base OS. +* **`CMD [...]`**: Defines the default command that runs when the container starts. Here, it simply prints a welcome message to the terminal. + +## 2. How to Build and Run + +### Step 1: Build the Image +Navigate to the `docker/basics/` directory and run the following command to package the Dockerfile into an image named `hello-docker`: + +```bash +docker build -t hello-docker +``` +### Step 2: Run the Container +Once the build is complete, run an instance of the image: +```bash +docker run hello-docker +``` +### Expected Output
+You should see the following message in your terminal: +```Plaintext +Hello, World! Welcome to your first Docker container. +``` +### 3. Useful Commands +Here are some commands to help you manage what you just created.
+**List Images**
+Check which images currently exist on your machine. You should see hello-docker in this list. + +```Bash +docker images +``` +**Check Container Status**
+Since our container runs a simple echo command, it exits immediately after finishing. To see it, you must use the -a (all) flag to list stopped containers. +```Bash +# List only running containers (won't show our hello-world) +docker ps +# List ALL containers (including stopped ones) +docker ps -a +``` +**Clean Up**
+To delete the specific container and image we created: +1. Remove the stopped container +```Bash +docker rm +``` +2. Remove the image +``` +docker rmi hello-docker +``` diff --git a/level-4-kubernetes/README.md b/level-4-kubernetes/README.md index 24b2754..8d75f2a 100644 --- a/level-4-kubernetes/README.md +++ b/level-4-kubernetes/README.md @@ -1,50 +1,50 @@ -# Level 4: Kubernetes - -## πŸ“Œ Objective -Understand Kubernetes architecture, deployments, services, and hands-on labs. - ---- - -## 🧠 What You Will Learn -- Core concepts related to this level -- Hands-on practical skills -- Real-world DevOps use cases - ---- - -## πŸ“‚ Folder Structure -- `concepts/` or `basics/` β†’ Theory and explanations -- `tasks/` or `projects/` β†’ Hands-on exercises -- `solutions/` β†’ Reference implementations (optional) - ---- - -## βœ… Prerequisites -- Basic Linux knowledge -- Willingness to practice (not just read) - ---- - -## πŸ§ͺ How to Use This Level -1. Read the concepts -2. Complete the tasks -3. Try projects without looking at solutions -4. Compare with solutions only after attempting - ---- - -## 🀝 Contribution Guidelines -You can contribute by: -- Adding tasks -- Improving explanations -- Fixing mistakes -- Adding real-world examples - -Follow the main `CONTRIBUTING.md` rules. - ---- - -## πŸš€ Progression -Complete this level before moving to the next one in the roadmap. - -Happy Learning & Building πŸ› οΈ +# Level 4: Kubernetes + +## πŸ“Œ Objective +Understand Kubernetes architecture, deployments, services, and hands-on labs. + +--- + +## 🧠 What You Will Learn +- Core concepts related to this level +- Hands-on practical skills +- Real-world DevOps use cases + +--- + +## πŸ“‚ Folder Structure +- `concepts/` or `basics/` β†’ Theory and explanations +- `tasks/` or `projects/` β†’ Hands-on exercises +- `solutions/` β†’ Reference implementations (optional) + +--- + +## βœ… Prerequisites +- Basic Linux knowledge +- Willingness to practice (not just read) + +--- + +## πŸ§ͺ How to Use This Level +1. Read the concepts +2. Complete the tasks +3. Try projects without looking at solutions +4. Compare with solutions only after attempting + +--- + +## 🀝 Contribution Guidelines +You can contribute by: +- Adding tasks +- Improving explanations +- Fixing mistakes +- Adding real-world examples + +Follow the main `CONTRIBUTING.md` rules. + +--- + +## πŸš€ Progression +Complete this level before moving to the next one in the roadmap. + +Happy Learning & Building πŸ› οΈ diff --git a/level-5-ci-cd/README.md b/level-5-ci-cd/README.md index 59422fc..f86f2aa 100644 --- a/level-5-ci-cd/README.md +++ b/level-5-ci-cd/README.md @@ -1,50 +1,50 @@ -# Level 5: CI/CD - -## πŸ“Œ Objective -Learn Continuous Integration and Continuous Deployment using GitHub Actions and Jenkins. - ---- - -## 🧠 What You Will Learn -- Core concepts related to this level -- Hands-on practical skills -- Real-world DevOps use cases - ---- - -## πŸ“‚ Folder Structure -- `concepts/` or `basics/` β†’ Theory and explanations -- `tasks/` or `projects/` β†’ Hands-on exercises -- `solutions/` β†’ Reference implementations (optional) - ---- - -## βœ… Prerequisites -- Basic Linux knowledge -- Willingness to practice (not just read) - ---- - -## πŸ§ͺ How to Use This Level -1. Read the concepts -2. Complete the tasks -3. Try projects without looking at solutions -4. Compare with solutions only after attempting - ---- - -## 🀝 Contribution Guidelines -You can contribute by: -- Adding tasks -- Improving explanations -- Fixing mistakes -- Adding real-world examples - -Follow the main `CONTRIBUTING.md` rules. - ---- - -## πŸš€ Progression -Complete this level before moving to the next one in the roadmap. - -Happy Learning & Building πŸ› οΈ +# Level 5: CI/CD + +## πŸ“Œ Objective +Learn Continuous Integration and Continuous Deployment using GitHub Actions and Jenkins. + +--- + +## 🧠 What You Will Learn +- Core concepts related to this level +- Hands-on practical skills +- Real-world DevOps use cases + +--- + +## πŸ“‚ Folder Structure +- `concepts/` or `basics/` β†’ Theory and explanations +- `tasks/` or `projects/` β†’ Hands-on exercises +- `solutions/` β†’ Reference implementations (optional) + +--- + +## βœ… Prerequisites +- Basic Linux knowledge +- Willingness to practice (not just read) + +--- + +## πŸ§ͺ How to Use This Level +1. Read the concepts +2. Complete the tasks +3. Try projects without looking at solutions +4. Compare with solutions only after attempting + +--- + +## 🀝 Contribution Guidelines +You can contribute by: +- Adding tasks +- Improving explanations +- Fixing mistakes +- Adding real-world examples + +Follow the main `CONTRIBUTING.md` rules. + +--- + +## πŸš€ Progression +Complete this level before moving to the next one in the roadmap. + +Happy Learning & Building πŸ› οΈ diff --git a/level-6-cloud-aws/README.md b/level-6-cloud-aws/README.md index 0bf9373..3cce3a9 100644 --- a/level-6-cloud-aws/README.md +++ b/level-6-cloud-aws/README.md @@ -1,50 +1,50 @@ -# Level 6: Cloud (AWS) - -## πŸ“Œ Objective -Learn AWS cloud fundamentals and how DevOps tools integrate with cloud infrastructure. - ---- - -## 🧠 What You Will Learn -- Core concepts related to this level -- Hands-on practical skills -- Real-world DevOps use cases - ---- - -## πŸ“‚ Folder Structure -- `concepts/` or `basics/` β†’ Theory and explanations -- `tasks/` or `projects/` β†’ Hands-on exercises -- `solutions/` β†’ Reference implementations (optional) - ---- - -## βœ… Prerequisites -- Basic Linux knowledge -- Willingness to practice (not just read) - ---- - -## πŸ§ͺ How to Use This Level -1. Read the concepts -2. Complete the tasks -3. Try projects without looking at solutions -4. Compare with solutions only after attempting - ---- - -## 🀝 Contribution Guidelines -You can contribute by: -- Adding tasks -- Improving explanations -- Fixing mistakes -- Adding real-world examples - -Follow the main `CONTRIBUTING.md` rules. - ---- - -## πŸš€ Progression -Complete this level before moving to the next one in the roadmap. - -Happy Learning & Building πŸ› οΈ +# Level 6: Cloud (AWS) + +## πŸ“Œ Objective +Learn AWS cloud fundamentals and how DevOps tools integrate with cloud infrastructure. + +--- + +## 🧠 What You Will Learn +- Core concepts related to this level +- Hands-on practical skills +- Real-world DevOps use cases + +--- + +## πŸ“‚ Folder Structure +- `concepts/` or `basics/` β†’ Theory and explanations +- `tasks/` or `projects/` β†’ Hands-on exercises +- `solutions/` β†’ Reference implementations (optional) + +--- + +## βœ… Prerequisites +- Basic Linux knowledge +- Willingness to practice (not just read) + +--- + +## πŸ§ͺ How to Use This Level +1. Read the concepts +2. Complete the tasks +3. Try projects without looking at solutions +4. Compare with solutions only after attempting + +--- + +## 🀝 Contribution Guidelines +You can contribute by: +- Adding tasks +- Improving explanations +- Fixing mistakes +- Adding real-world examples + +Follow the main `CONTRIBUTING.md` rules. + +--- + +## πŸš€ Progression +Complete this level before moving to the next one in the roadmap. + +Happy Learning & Building πŸ› οΈ diff --git a/workflows/ci.yml b/workflows/ci.yml index 785eafb..e2e2e5a 100644 --- a/workflows/ci.yml +++ b/workflows/ci.yml @@ -1,32 +1,32 @@ -name: CI - DevOps Validation - -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - -jobs: - validate: - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Install lint tools - run: | - sudo apt-get update - sudo apt-get install -y shellcheck yamllint - - - name: ShellCheck (bash scripts) - run: | - if find . -name "*.sh" | grep -q .; then - find . -name "*.sh" -exec shellcheck {} + - else - echo "No shell scripts found" - fi - - - name: YAML lint - run: | - yamllint . +name: CI - DevOps Validation + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + validate: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install lint tools + run: | + sudo apt-get update + sudo apt-get install -y shellcheck yamllint + + - name: ShellCheck (bash scripts) + run: | + if find . -name "*.sh" | grep -q .; then + find . -name "*.sh" -exec shellcheck {} + + else + echo "No shell scripts found" + fi + + - name: YAML lint + run: | + yamllint . diff --git a/workflows/lint.yml b/workflows/lint.yml new file mode 100644 index 0000000..c11ee44 --- /dev/null +++ b/workflows/lint.yml @@ -0,0 +1,39 @@ +name: CI Lint + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + shellcheck: + name: Lint shell scripts + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install ShellCheck + run: sudo apt-get install -y shellcheck + + - name: Run ShellCheck on all .sh files + run: | + find . -name "*.sh" -not -path "./.git/*" | xargs shellcheck + + yamllint: + name: Lint YAML files + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install yamllint + run: pip install yamllint + + - name: Run yamllint on all YAML files + run: | + find . \( -name "*.yml" -o -name "*.yaml" \) \ + -not -path "./.git/*" | xargs yamllint -d relaxed