π DevOps Week 2 β Linux OS Fundamentals & Shell Scripting
Learn Linux commands, shell scripting fundamentals, and build a real-world AWS Resource Tracker project to automate monitoring and optimize cloud costs.

πΉ 1. What is an Operating System (OS)?
- OS = Interface between Hardware & Software
π It acts as a bridge:
Hardware (CPU, RAM, Disk)
Software (Applications, Programs)
π― Functions of OS:
Process management
Memory management
File system management
Device control
π Example OS:
Linux
Windows
macOS
πΉ 2. What is Linux?
Linux = Open-source Operating System
Widely used in:
Servers
Cloud (AWS, Azure)
DevOps
β Why Linux is Important
Free & open source
Secure
Lightweight
Most servers run on Linux
πΉ 3. Linux Architecture (Basic Idea)
User β Shell β Kernel β Hardware
β Components:
Kernel β Core of OS (controls hardware)
Shell β Interface to interact with system
File System β Organizes data
πΉ 4. What is Shell?
- Shell = Command Line Interface (CLI)
π It allows:
Running commands
Managing files
Executing scripts
β Types of Shell:
Bash (most common)
Sh
Zsh
π Linux & Shell Scripting
πΉ 1. Introduction
This video teaches:
Basic Linux commands
File handling
Shell scripting basics
Automation concepts
π Focus: Learn Linux + start scripting
πΉ 2. Purpose of Scripting & Automation
- Instead of doing tasks manually:
π Use scripts to automate
β Example:
Backup files
Run multiple commands at once
π Benefit:
Saves time
Reduces errors
πΉ 3. How to Create a File?
touch file.txt
π Creates empty file
πΉ 4. List Files & Folders
ls
π Shows all files
πΉ 5. man Command
man ls
π Shows manual/help of command
πΉ 6. vi / vim Editor (Write File)
vim file.txt
π Used to:
Create file
Edit file
Modes in vim:
Insert mode β write text
Command mode β run commands
πΉ 7. Difference: touch vs vim
| touch | vim |
|---|---|
| Creates file only | Create + edit file |
| No content | Can write content |
πΉ 8. Copy Content in Linux
cp file1 file2
π Copy file
πΉ 9. #!/bin/bash or #!/bin/sh
- Called Shebang
π Purpose:
- Tells system: π Which shell to use to run script
πΉ 10. Difference: bash, ksh, dash
| Shell | Use |
|---|---|
| bash | Most common |
| ksh | Advanced scripting |
| dash | Lightweight & fast |
πΉ 11. Insert Command (vim)
Press
iβ enter insert modeStart writing
πΉ 12. echo Command
echo "Hello"
π Print output
πΉ 13. Execute Shell Script
./script.sh
πΉ 14. Grant Permissions
chmod +x script.sh
π Makes script executable
πΉ 15. chmod Command
chmod 777 file.txt
π Change file permissions
Permission Types:
r = read
w = write
x = execute
πΉ 16. Check Command History
history
π Shows previously used commands
πΉ 17. Create Folder
mkdir foldername
πΉ 18. Change Directory
cd foldername
πΉ 19. Simple Shell Script
#!/bin/bash
echo "Hello World"
πΉ 20. Purpose of Shell Scripting in DevOps
Automate tasks
Deploy applications
Run pipelines
π Very important in DevOps
πΉ 21. Check CPU & RAM
free -h
π Shows RAM
lscpu
π Shows CPU info
πΉ 22. Top Command
top
π Shows:
Running processes
CPU usage
Memory usage
π Node Health, Debugging, Pipes, AWK, Advanced Scripting
πΉ 1. DevOps Use Case: Node Health Check
π Goal: Check if a server (node) is healthy or not
β What to check:
CPU usage
Memory (RAM)
Disk space
Running processes
πΉ 2. Sample Node Health Script (Basic Idea)
#!/bin/bash
echo "Checking system health..."
top
free -h
df -h
π This script checks:
CPU β
topRAM β
free -hDisk β
df -h
πΉ 3. Good Practices in Scripting
Use clear variable names
Add comments
Use echo statements
Handle errors properly
π Makes script readable & professional
πΉ 4. Improve Script Readability
echo "Checking CPU usage..."
echo "Checking Memory..."
π Helps understand output clearly
πΉ 5. Debug Mode
set -x
π Shows:
- Each command before execution
π Used for debugging
πΉ 6. What are Processes?
- Process = Running program
β List Processes:
ps
β Find Process ID:
ps -ef
πΉ 7. grep & Pipe (|) β VERY IMPORTANT π₯
β Pipe:
- Pass output of one command β another
ps -ef | grep nginx
π Find specific process
π― Interview Point:
π Pipe = connects multiple commands
πΉ 8. AWK Command
Used for:
Filtering
Extracting specific columns
ps -ef | awk '{print $2}'
π Prints process ID
πΉ 9. set -e (Error Handling)
set -e
π Script stops if error occurs
πΉ 10. set -o pipefail
set -o pipefail
π If any command in pipeline fails β script fails
π Important for production scripts
πΉ 11. DevOps Use Case: Search Errors in Logs
grep "error" logfile.txt
π Used to:
Debug issues
Find failures
πΉ 12. wget Command
wget <url>
π Download files from internet
πΉ 13. CURL vs WGET
| CURL | WGET |
|---|---|
| API calls | File download |
| More flexible | Simple download |
πΉ 14. find Command
find . -name "file.txt"
π Search files
πΉ 15. sudo vs su
| Command | Use |
|---|---|
| sudo | Run as admin |
| su | Switch user |
πΉ 16. If-Else in Shell
if [ \(a -gt \)b ]
then
echo "A is greater"
else
echo "B is greater"
fi
πΉ 17. For Loop
for i in 1 2 3
do
echo $i
done
πAWS Resource Tracker Project
πΉ 1. Project Goal
π Build script to:
Track AWS resources
Reduce cost
β Why Important?
Cloud = Pay-as-you-go
- Unused resources = Money waste
π Example:
Unused EC2
Orphaned EBS
πΉ 2. Tools Used
AWS CLI
Bash scripting
Cron jobs
πΉ 3. Resource Tracking Commands
β S3 Buckets:
aws s3 ls
β EC2 Instances:
aws ec2 describe-instances
β Lambda:
aws lambda list-functions
β IAM Users:
aws iam list-users
πΉ 4. Debug Mode
set -x
π Used to debug script
πΉ 5. JSON Parsing using JQ
jq '.Reservations[].Instances[].InstanceId'
π Extract specific data from JSON
πΉ 6. Automation using Cron Job
crontab -e
π Schedule script
β Example:
0 9 * * * /home/script.sh
π Runs daily at 9 AM
πΉ 7. Full Workflow
Write script
Fetch AWS data
Filter using JQ
Generate report
Automate using cron
πΉ 8. Real DevOps Use Case
π Companies use this to:
Track unused resources
Save cost
Monitor infrastructure
Project link - https://github.com/hritikranjan1/shell-scripting-projects.git
π Git, GitHub, Branching & GitHub API (Simple Flow)
πΉ 1. Problem Statement (Real DevOps Scenario)
As a DevOps Engineer π
You manage multiple repositories
Many users have access
π Problem:
Checking access manually from GitHub UI is slow & inefficient
Especially during employee offboarding
π Solution:
- Use GitHub API + Automation Script
πΉ 2. API vs CLI (Important Concept)
β CLI (Command Line Interface)
- Direct commands in terminal π Example:
kubectl get pods
β API (Application Programming Interface)
Communicate with apps using:
HTTP requests
JSON data
π Example:
curl https://api.github.com/repos
π― Difference:
| CLI | API |
|---|---|
| Easy to use | More flexible |
| Limited control | Full control |
| Manual usage | Automation friendly |
πΉ 3. GitHub API Integration (Main Concept)
π GitHub provides APIs to:
Get repo details
List users
Check PRs & issues
β How it works:
Send request using
curlGet response in JSON
Filter using
jq
π Example:
curl https://api.github.com/repos/user/repo
β Parsing Data:
jq '.[] | .login'
π Extract useful data from JSON
πΉ 4. Script Flow (Project)
π Steps used in video:
Clone script
Add GitHub token (for authentication)
Run script
Fetch repo data
Filter users
Show authorized users
β Tools Used:
curl
jq
Bash scripting
β Improvement Tips:
Use functions
Add comments
Handle errors
πΉ 5. Introduction to Version Control (VCS)
π VCS = Track changes in code
β Why we need VCS?
Multiple developers work together
Track changes/history
Go back to old version
πΉ 6. Types of Version Control
β Centralized (Old)
Example: SVN
One central server
π Problem:
- If server down β work stops
β Distributed (Git)
- Each user has full copy
π Benefit:
- Work even offline
πΉ 7. Git vs GitHub
| Git | GitHub |
|---|---|
| Tool | Platform |
| Local system | Cloud |
| Version control | Collaboration |
πΉ 8. Git Basic Workflow (Very Important π₯)
π Git lifecycle:
Working Directory β Staging β Repository
β Commands:
1. Initialize repo
git init
2. Check status
git status
3. Add files
git add .
4. Commit changes
git commit -m "message"
5. View history
git log
6. See changes
git diff
πΉ 9. Push Code to GitHub
git push
π Upload local code to GitHub
πΉ 10. Clone vs Fork
β Clone:
git clone <repo-url>
π Download repo locally
β Fork:
π Copy repo on GitHub
π Used for:
- Open-source contribution
πΉ 11. Branching Concept (VERY IMPORTANT π₯)
β Why Branching?
Work on new feature safely
Donβt break main code
β Main Branch:
main/masterπ Production-ready code
β Other Branches:
Feature Branch β New feature
Release Branch β Prepare release
Hotfix Branch β Fix urgent bug
πΉ 12. Branch Workflow
π Steps:
Create branch
Work on feature
Test code
Merge to main
πΉ 13. Merge Strategies
β Git Merge
Combine branches
Keeps history
β Git Rebase
- Clean linear history
π Preferred in large projects
β Git Cherry-pick
- Copy specific commit
πΉ 14. Git Lifecycle (Full Flow)
git init β git add β git commit β git push
πΉ 15. Important Git Commands
git pullβ Get latest codegit remoteβ Manage repo linkgit branchβ Show branches
πΉ 16. Real DevOps Workflow
Developer writes code
Create feature branch
Commit changes
Push to GitHub
Create PR (Pull Request)
Review & merge
πΉ 17. Key Takeaways
Git = Version control
GitHub = Collaboration platform
Branching = Safe development
API = Automation
Scripts = Save time
π Continue Your Learning Journey
Thank you for taking the time to read this article.
Technology is evolving rapidly, and continuous learning is one of the most valuable investments you can make in your career. Whether you're exploring DevOps, Cloud Computing, Artificial Intelligence, Cybersecurity, Software Development, Data Science, or Career Growth, the resources below can help you deepen your knowledge and stay ahead in the industry.
π Recommended Learning Platforms
π Coursera
Learn from world-renowned universities and industry leaders including Google, IBM, Stanford, Microsoft, Meta, and many more.
β Professional Certificates β Career-focused Learning Paths β AI & Machine Learning Programs β Cloud & DevOps Certifications β Business & Leadership Courses
π https://imp.i384100.net/k0KvbV
π» Udemy
One of the largest online learning platforms with practical, hands-on courses covering:
β DevOps & Kubernetes β Docker & Cloud Computing β AWS, Azure & GCP β Programming & Development β Cybersecurity & Ethical Hacking
π https://trk.udemy.com/MAL2MY
π DataCamp
A great platform for anyone interested in:
β Python Programming β SQL & Databases β Data Analytics β Machine Learning β Artificial Intelligence
Interactive learning paths and hands-on projects make it ideal for beginners and professionals alike.
π https://datacamp.pxf.io/nX4kER
π edX
Access high-quality courses and certifications from leading institutions such as:
β Harvard University β MIT β Berkeley β Microsoft
Perfect for learners seeking university-level education online.
π https://edx.sjv.io/POvVeN
π¨ Domestika
Enhance your creative skills with courses on:
β Graphic Design β Video Editing β Animation β Digital Marketing β Content Creation
π https://domestika.sjv.io/dynKAW
π οΈ Recommended Tools & Resources
π₯ AppSumo
Discover exclusive lifetime deals on:
β AI Tools β Productivity Software β Developer Utilities β Marketing Platforms β Business Applications
A must-have resource for developers, creators, freelancers, and entrepreneurs looking to save money while accessing premium tools.
π https://appsumo.8odi.net/L04a33
π Shopify
Looking to start an online business or launch an eCommerce store?
Shopify provides everything you need to build, manage, and scale an online business.
β Online Store Builder β Payment Integration β Inventory Management β Marketing Tools
π https://shopify.pxf.io/Vxv09k
π WordPress, WooCommerce & Jetpack
Create professional websites, blogs, and online stores with one of the most trusted web ecosystems in the world.
Ideal for:
β Personal Blogs β Portfolio Websites β Business Websites β eCommerce Stores
π https://automattic.pxf.io/Z6vR5W
π Language Learning Resources
π£οΈ Preply
Learn English and other languages through personalized one-on-one tutoring sessions with experts from around the world.
π https://preply.sjv.io/o4gBDY
π British Council English Online
Improve your professional communication skills and English fluency through structured learning programs.
π https://englishonline.sjv.io/9VOGa4
π§ Rosetta Stone
One of the most recognized language-learning platforms for immersive language acquisition.
π https://aff.rosettastone.com/X4OyqG
π§ͺ Science & Educational Resources
π¬ MEL Science
Interactive science kits and educational experiences designed to make STEM learning engaging and practical.
π https://imp.i328067.net/bk2beg
π Carson Dellosa Education
Educational materials and learning resources for students, teachers, and lifelong learners.
π https://carsondellosaeducation.sjv.io/E0JbjW
β€οΈ Support My Work
Creating detailed technical content, tutorials, guides, and learning resources takes significant time and effort.
If you find my articles helpful and would like to support my work, you can do so through the following platforms:
β Become a GitHub Sponsor
Support my open-source contributions, technical content, and community projects.
π https://github.com/sponsors/hritikranjan1
β Buy Me a Chai
Enjoying my content? Consider buying me a chai and supporting future tutorials, guides, and educational resources.
π https://www.chai4.me/hritikranjan
π¨βπ» Connect With Me
Hritik Ranjan
π‘ AI Enthusiast βοΈ DevOps Learner π Cybersecurity Advocate π» Software Developer
Connect & Follow
π GitHub: https://github.com/hritikranjan1
π LinkedIn: https://linkedin.com/in/hritikranjan1
π’ Found This Article Helpful?
If this article added value to your learning journey:
β
Share it with your network
β
Bookmark it for future reference
β
Follow for more DevOps, AI, Cloud, Cybersecurity, and Software Engineering content
Thank you for reading and being part of this learning journey.
Keep Learning. Keep Building. Keep Growing. π






