diff --git a/07_Linux_Logs_Disk_Management.md b/07_Linux_Logs_Disk_Management.md new file mode 100644 index 0000000..7a9da24 --- /dev/null +++ b/07_Linux_Logs_Disk_Management.md @@ -0,0 +1,137 @@ +# Linux – Logs & Disk Management (Day 7) + +## Why Logs Are Important in DevOps? +Logs tell you: +- what happened +- when it happened +- why something failed + +In production, logs are the FIRST place to check. + +--- + +## Log Directory +Most Linux logs are stored here: +```bash +/var/log +``` + +List log files: +```bash +ls /var/log +``` + +Common logs: +- syslog +- auth.log +- kern.log +- boot.log + +--- + +## View Log Files + +### cat (small files) +```bash +cat /var/log/syslog +``` + +### less (recommended) +```bash +less /var/log/syslog +``` + +Navigation: +- Up / Down arrows +- q → quit + +--- + +## Live Log Monitoring +```bash +tail -f /var/log/syslog +``` + +Very useful when debugging live issues. + +--- + +## Search Inside Logs +```bash +grep error /var/log/syslog +``` + +Case-insensitive: +```bash +grep -i error /var/log/syslog +``` + +--- + +## Disk Space Management + +### Check Disk Usage +```bash +df -h +``` + +--- + +### Check Folder Size +```bash +du -sh /var/log +``` + +--- + +### Find Large Files +```bash +du -ah / | sort -rh | head -10 +``` + +⚠️ Use carefully (may need sudo) + +--- + +## Clear Log Files (Safe Method) +```bash +sudo truncate -s 0 /var/log/syslog +``` + +❌ Do NOT delete system log files blindly. + +--- + +## Real DevOps Scenario +Problem: Server disk full + +Steps: +1. Check disk usage +2. Identify large directories +3. Clear old logs safely + +Commands: +```bash +df -h +du -sh +tail -f +``` + +--- + +## Common Mistakes +- Deleting log files directly +- Ignoring disk alerts +- Not monitoring log growth + +--- + +## DevOps Rule +✅ Monitor logs regularly +❌ Ignore disk usage + +--- + +## Summary +Today I learned Linux log monitoring and disk management. +These skills are critical for production troubleshooting. diff --git a/08_Git_Basics.md b/08_Git_Basics.md new file mode 100644 index 0000000..e0b67ff --- /dev/null +++ b/08_Git_Basics.md @@ -0,0 +1,140 @@ +# Git – Basics for DevOps (Day 8) + +## What is Git? +Git is a version control system. +It helps you track changes in code and collaborate safely. + +DevOps engineers use Git DAILY. + +--- + +## Why Git is Important for DevOps? +- Track code changes +- Collaborate with teams +- Rollback broken deployments +- CI/CD depends on Git + +--- + +## Install Git +```bash +git --version +``` + +If not installed: +```bash +sudo apt install git +``` + +--- + +## Configure Git (One-time Setup) +```bash +git config --global user.name "Your Name" +git config --global user.email "your@email.com" +``` + +Check config: +```bash +git config --list +``` + +--- + +## Create a Git Repository +```bash +mkdir devops-project +cd devops-project +git init +``` + +--- + +## Git Workflow (Basic) +1. Modify files +2. Stage changes +3. Commit changes + +--- + +## Check Repository Status +```bash +git status +``` + +--- + +## Add Files to Staging +```bash +git add file.txt +``` + +Add all files: +```bash +git add . +``` + +--- + +## Commit Changes +```bash +git commit -m "Initial commit" +``` + +--- + +## View Commit History +```bash +git log +``` + +Short view: +```bash +git log --oneline +``` + +--- + +## Check File Differences +```bash +git diff +``` + +--- + +## Undo Changes (Basic) + +Undo unstaged changes: +```bash +git checkout -- file.txt +``` + +--- + +## Real DevOps Scenario +Problem: New code broke production + +Solution: +1. Check commit history +2. Roll back to stable commit + +Git saves lives in production. + +--- + +## Common Mistakes +- Committing without message +- Forgetting git add +- Working directly on main branch + +--- + +## DevOps Rule +✅ Commit small changes +❌ Commit everything at once + +--- + +## Summary +Today I learned Git basics: init, add, commit, status, and log. +These are core DevOps skills. diff --git a/09_Git_Branching_Merging.md b/09_Git_Branching_Merging.md new file mode 100644 index 0000000..124121d --- /dev/null +++ b/09_Git_Branching_Merging.md @@ -0,0 +1,124 @@ +# Git – Branching & Merging (Day 9) + +## Why Branching is Important? +Branching allows teams to: +- work on features safely +- fix bugs without breaking main code +- collaborate without conflicts + +DevOps uses branching DAILY. + +--- + +## What is a Branch? +A branch is a separate line of development. + +Main branch = stable production code +Feature branch = new changes + +--- + +## View Branches +```bash +git branch +``` + +--- + +## Create a New Branch +```bash +git branch feature-login +``` + +Switch to branch: +```bash +git checkout feature-login +``` + +Shortcut (create + switch): +```bash +git checkout -b feature-login +``` + +--- + +## Check Current Branch +```bash +git branch +``` +(* shows active branch) + +--- + +## Make Changes in Branch +```bash +echo "Login feature" >> login.txt +git add . +git commit -m "add login feature" +``` + +--- + +## Merge Branch into Main +Switch to main: +```bash +git checkout main +``` + +Merge: +```bash +git merge feature-login +``` + +--- + +## Delete Branch (After Merge) +```bash +git branch -d feature-login +``` + +--- + +## Merge Conflicts (Important) +Occurs when same file is changed in two branches. + +Git will stop and ask you to fix manually. + +Steps: +1. Open conflicted file +2. Fix content +3. Save file +4. Add & commit + +```bash +git add . +git commit -m "resolve merge conflict" +``` + +--- + +## Real DevOps Scenario +Problem: Multiple developers pushing code + +Solution: +- Each dev uses own branch +- Merge after testing + +--- + +## Common Mistakes +- Working directly on main +- Not pulling latest code +- Deleting branch before merge + +--- + +## DevOps Rule +✅ One feature = one branch +❌ Direct commits to main + +--- + +## Summary +Today I learned Git branching, merging, and conflict handling. +This is essential for DevOps collaboration. diff --git a/10_GitHub_DevOps_Workflow.md b/10_GitHub_DevOps_Workflow.md new file mode 100644 index 0000000..d443328 --- /dev/null +++ b/10_GitHub_DevOps_Workflow.md @@ -0,0 +1,100 @@ +# GitHub – DevOps Workflow (Day 10) + +## What is GitHub? +GitHub is a cloud platform to host Git repositories. +It allows teams to collaborate, review code, and trigger CI/CD pipelines. + +DevOps engineers use GitHub daily. + +--- + +## Why GitHub is Important for DevOps? +- Central code storage +- Team collaboration +- CI/CD integration +- Code reviews and approvals + +--- + +## Create GitHub Account +Go to https://github.com and create a free account. + +--- + +## Connect Local Repository to GitHub + +Create a new repository on GitHub (do NOT add README). + +Then run: +```bash +git remote add origin https://github.com/username/repo-name.git +``` + +Verify: +```bash +git remote -v +``` + +--- + +## Push Code to GitHub +```bash +git push -u origin main +``` + +--- + +## Clone a Repository +```bash +git clone https://github.com/username/repo-name.git +``` + +--- + +## Pull Latest Changes +```bash +git pull origin main +``` + +--- + +## GitHub DevOps Workflow +1. Create feature branch +2. Push branch to GitHub +3. Open Pull Request +4. Code review & approval +5. Merge to main +6. CI/CD deploys automatically + +--- + +## Pull Requests (PR) +A Pull Request is a request to merge code into the main branch. +Used for safe deployments and team collaboration. + +--- + +## Real DevOps Scenario +Multiple developers working together: +- Everyone works on own branch +- PRs ensure stability +- CI checks before merge + +--- + +## Common Mistakes +- Pushing directly to main +- Not pulling latest changes +- Ignoring PR reviews + +--- + +## DevOps Rule +✅ Always use Pull Requests +❌ Never push directly to main + +--- + +## Summary +Today I learned GitHub basics for DevOps including clone, push, pull, +and Pull Request workflow used in real companies.