Get in Touch

Course Outline

Day 1
Module 1: Introduction to Python for Unix Users

Topics
Why Python is ideal for scripting and automation
• advantages of using Python for scripting
• the role of Python in system administration and DevOps

Comparing Bash and Python
• variables
• control flow (if statements, loops)
• working with files
• executing system commands

Structure of a Python script
• running Python scripts
• utilizing the interpreter
• passing command-line arguments
• introduction to argparse

Exercises
Exercise 1 – Converting a simple Bash script to Python
A Bash script that:
• lists files from a directory
• filters by file extension
• displays statistical data
Participants will rewrite this script in Python.

Exercise 2 – Creating a Python script with CLI arguments
Developing a Python script that:
• accepts parameters from the command line
• processes files
• outputs structured results

Module 2: File and Directory Manipulation

Topics
Managing the file system in Python
• reading and writing files
• navigating directories
• handling paths

Utilizing the pathlib module
• path management
• file operations

Replacing Unix utilities
• grep
• find
• sed
• awk
with equivalent Python implementations

Exercises
Exercise 1 – Scanning the file system
A Python script that:
• searches for large files
• identifies older files
• generates a summary report

Exercise 2 – Processing configuration files
A Python script that:
• reads text-based files
• extracts key information
• generates statistical summaries

Day 2
Module 3: Log Processing and Text Manipulation

Topics
Working with text in Python
• string operations
• filtering and transforming data

Regular expressions (regex)
• pattern identification
• parsing log files

Replacing shell pipelines
Example:
Implementing 'grep | awk | sed | sort' chains in Python

Exercises
Exercise 1 – Analyzing log files
A Python script that:
• reads system logs
• identifies error entries
• calculates the frequency of errors

Exercise 2 – Converting a shell pipeline to Python
Transforming a complex Bash pipeline into an efficient Python script

Module 4: Automating System Commands

Topics
Executing shell commands from within Python
• using the subprocess module
• capturing command output
• handling errors

Automating administrative tasks
• running system commands programmatically
• integrating with cron jobs
• scripting for repetitive tasks

Process management
• monitoring active processes
• implementing simple parallel execution

Exercises
Exercise 1 – Running system commands via Python
A script that:
• executes Unix commands
• captures the output
• generates reports

Exercise 2 – Monitoring services
A Python script that:
• checks the status of a specific service
• collects relevant information
• displays the results

Day 3
Module 5: Advanced Automation and Interaction with External Services

Topics
Working with APIs in Python
• introduction to HTTP requests
• authentication methods and token management
• processing JSON responses

Using Python for DevOps automation
• gathering data from external services
• integrating with existing tools
• infrastructure scripting

Exercises
Exercise 1 – Consuming an API via Python
A script that:
• collects data from an API endpoint
• processes the retrieved information
• generates a summary report

Exercise 2 – Automating data collection
A Python script that:
• collects system information
• generates a report in JSON or CSV format

Module 6: Building a CLI Tool for Administration

Topics
Structuring a Python project
• organizing code effectively
• reusing functions
• utilizing modules and packages

Creating a CLI tool
• handling command-line arguments
• producing structured output
• implementing robust error handling

Final exercise
Participants will construct a CLI automation tool in Python that:
• analyzes log files
• identifies errors
• generates statistics
• can be executed directly from the command line

Course Outcomes
Upon completing the course, participants will be able to:
• translate shell scripts into Python equivalents
• leverage Python for automating system tasks
• process logs and complex datasets
• develop CLI tools for Unix system administration

Requirements

Prerequisites

  • Fundamental knowledge of Unix/Linux operating systems
  • Familiarity with command-line usage (shell/Bash)
  • Experience in writing basic shell scripts (e.g., loops, conditional statements, file operations)
  • A general understanding of system administration concepts is advantageous
  • No prior Python experience is required

Target Audience

  • System administrators working within Unix/Linux environments
  • DevOps engineers seeking to enhance their automation capabilities
  • Engineers and technical specialists who rely on shell scripting for daily tasks
  • IT professionals interested in transitioning from Bash to Python
  • Developers working in Unix environments who wish to automate workflows more efficiently
 21 Hours

Number of participants


Price per participant

Testimonials (2)

Provisional Upcoming Courses (Require 5+ participants)

Related Categories