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 Python for scripting
• utilizing Python in system administration and DevOps

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

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

Exercises
Exercise 1 – Converting a simple Bash script to Python
Bash script that:
• lists files from a directory • filters by extension • displays statistics Participants will rewrite the script in Python.

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

Module 2: File and Directory Manipulation

Topics
Working with the filesystem in Python
• reading and writing files • navigating directories • handling paths

Using the pathlib module
• path management • file operations

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

Exercises
Exercise 1 – Filesystem scanning Python script that:
• searches for large files • identifies old files • generates a report

Exercise 2 – Processing configuration files Python script that:
• reads text files • extracts relevant information • generates statistics

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 • log parsing

Replacing shell pipelines
Example:
grep | awk | sed | sort implemented in Python

Exercises
Exercise 1 – Log file analysis Python script that:
• reads system logs • identifies errors • calculates error frequency

Exercise 2 – Converting a shell pipeline to Python Complex Bash pipeline transformed into a Python script

Module 4: Automating System Commands

Topics
Executing shell commands from Python
• subprocess module • capturing output • error handling

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

Process management • monitoring processes • simple parallel execution

Exercises
Exercise 1 – Python script that runs system commands Script that:
• runs Unix commands • captures output • generates reports

Exercise 2 – Service monitoring Python script that:
• checks the status of a service • collects information • displays results

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

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

Python for DevOps automation • collecting data from external services • integration with existing tools • infrastructure scripting

Exercises
Exercise 1 – Python script consuming an API Script that:
• collects data from an API • processes the information • generates a report

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

Module 6: Building a CLI Tool for Administration

Topics
Structuring a Python project
• code organisation • function reuse • modules and packages

Creating a CLI tool • command line arguments • structured output • error handling

Final exercise
Participants will build a CLI automation tool in Python that:
• analyses log files • identifies errors • generates statistics • can be run from the command line

Course Outcomes
By the end of the course participants will be able to:
• transform shell scripts into Python scripts • use Python for automating system tasks • process logs and complex data • build CLI tools for Unix system administration

Requirements

Prerequisites

  • Fundamental knowledge of Unix/Linux operating systems
  • Familiarity with command-line usage (shell/Bash)
  • Experience writing basic shell scripts (e.g., loops, conditions, 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 utilize shell scripting for daily tasks
  • IT professionals interested in transitioning from Bash to Python
  • Developers operating in Unix environments who wish to automate workflows more efficiently
 21 Hours

Number of participants


Price per participant

Testimonials (2)

Upcoming Courses

Related Categories