Skip to content

krmaryum/Shell-Scripts

Repository files navigation

Shell Scripts

A collection of practical Bash scripting projects, exercises, and reference materials covering Linux automation, system administration, log analysis, backup automation, scheduling, and shell scripting fundamentals.

Overview

This repository documents my hands-on journey learning Bash scripting through real-world projects and automation tasks. The scripts focus on practical Linux administration, DevOps automation, error handling, reporting, and system maintenance.

Repository Structure

Shell-Scripts/
├── Shell Scripting Basics/
├── Shell Scripting Loops Arguments Error Handling/
├── Shell Scripting Functions intermediate Concepts/
├── Shell Scripting Project Log Rotation Backup Crontab/
├── Bash Scripting Challenge Log Analyzer and Report/
├── Shell Scripting Cheat Sheet Build Your Own Reference Guide/
└── README.md

Topics Covered

Shell Scripting Basics

  • Shebang and script execution
  • Variables and quoting
  • User input handling
  • Conditional statements
  • File operations
  • Service status checks

Loops, Arguments & Error Handling

  • For loops
  • While loops
  • Command-line arguments
  • Package installation automation
  • Error handling techniques
  • Root privilege validation

Functions & Intermediate Concepts

  • Function creation and usage
  • Function arguments
  • Return values
  • Local variables
  • Strict mode (set -euo pipefail)
  • System information reporting

Log Rotation, Backup & Crontab

  • Automated log rotation
  • Backup automation
  • Archive management
  • Scheduled maintenance
  • Cron job configuration
  • Production-style automation

Log Analyzer & Report Generator

  • Log file validation
  • Error detection
  • Critical event extraction
  • Error statistics
  • Report generation
  • Linux text processing tools

Shell Scripting Cheat Sheet

  • Bash syntax reference
  • Loops and conditionals
  • Functions
  • Text processing commands
  • Error handling
  • DevOps one-liners

Projects Included

System Information Reporter

Collects and displays:

  • Hostname and OS information
  • System uptime
  • Disk usage statistics
  • Memory utilization
  • Top CPU-consuming processes

Package Installation Automation

Automatically:

  • Checks installed packages
  • Installs missing packages
  • Validates root privileges
  • Reports installation status

Log Rotation Utility

Features:

  • Compresses old log files
  • Removes outdated archives
  • Tracks processed files
  • Provides execution reports

Backup Automation Script

Features:

  • Creates timestamped backups
  • Verifies archive integrity
  • Cleans up old backups
  • Reports backup statistics

Maintenance Automation

Combines:

  • Log rotation
  • Backup operations
  • Timestamped logging
  • Cron scheduling

Log Analyzer

Provides:

  • Error counting
  • Critical event detection
  • Top error summaries
  • Daily report generation

Skills Demonstrated

  • Bash Scripting
  • Linux Administration
  • Process Automation
  • Log Analysis
  • Backup Management
  • Task Scheduling
  • Text Processing
  • Error Handling
  • System Monitoring
  • DevOps Fundamentals

Tools Used

  • Bash
  • grep
  • awk
  • sed
  • cut
  • sort
  • uniq
  • find
  • tar
  • gzip
  • cron
  • systemctl
  • df
  • free
  • ps

Learning Outcomes

Through these projects I gained practical experience with:

  • Writing modular and maintainable Bash scripts
  • Automating repetitive Linux administration tasks
  • Processing and analyzing log files
  • Implementing backup and recovery procedures
  • Creating scheduled maintenance workflows
  • Applying production-safe scripting practices
  • Using Linux text-processing utilities effectively

Author

Khalid Khan

Linux System Administrator | DevOps Engineer

GitHub: https://github.com/krmaryum

LinkedIn: https://www.linkedin.com/in/khalid-khan-93760a360

License

This repository is created for learning, practice, and demonstration purposes.

About

Collection of practical Bash scripting projects, Linux automation tasks, backup solutions, log analysis tools, and DevOps scripting exercises.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors