Get in Touch
 Duration 21 hours

Course Outline

Day 1
Module 1: Introduction to Python for Unix Users

Topics
Why Python is ideal for scripting and automation
• Key benefits of using Python for scripting
• Applications of Python in system administration and DevOps

Comparison between Bash and Python
• Variables
• Control flow structures (if statements, loops)
• File handling
• Executing system commands

Anatomy of a Python script
• Executing Python scripts
• Utilizing the interpreter
• Handling command line arguments
• Introduction to argparse

Exercises
Exercise 1 – Translating a simple Bash script to Python
A Bash script that:
• Lists files in a directory
• Filters by file extension
• Displays statistics
Participants will rewrite this logic in Python.

Exercise 2 – Python script with CLI arguments
Developing a Python script that:
• Accepts parameters via the command line
• Processes files
• Displays structured output

Module 2: File and Directory Manipulation

Topics
Interacting with the filesystem in Python
• Reading and writing files
• Navigating directories
• Managing paths

Leveraging the pathlib module
• Path management
• File operations

Substituting Unix utilities
• grep
• find
• sed
• awk
using Python equivalents

Exercises
Exercise 1 – Filesystem scanning
A Python script that:
• Locates large files
• Identifies old files
• Generates a report

Exercise 2 – Processing configuration files
A Python script that:
• Reads text files
• Extracts relevant data
• Compiles statistics

Day 2
Module 3: Log Processing and Text Manipulation

Topics
Handling text in Python
• String manipulation
• Filtering and transforming data

Regular expressions (regex)
• Identifying patterns
• Parsing logs

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

Exercises
Exercise 1 – Log file analysis
A Python script that:
• Reads system logs
• Identifies errors
• Calculates error frequency

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

Module 4: Automating System Commands

Topics
Executing shell commands from Python
• The subprocess module
• Capturing output
• Error handling

Automating administrative tasks
• Running system commands
• Integrating with cron jobs
• Scripting for repetitive tasks

Process management
• Monitoring processes
• Basic parallel execution

Exercises
Exercise 1 – Python script for running system commands
A script that:
• Executes Unix commands
• Captures output
• Generates reports

Exercise 2 – Service monitoring
A Python script that:
• Checks service status
• Collects relevant 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
• Gathering data from external services
• Integrating with existing tools
• Infrastructure scripting

Exercises
Exercise 1 – Python script consuming an API
A script that:
• Retrieves data from an API
• Processes the information
• Generates a report

Exercise 2 – Automating data collection
A 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 organization
• 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 executed from the command line

Course Outcomes
By the end of the course, participants will be able to:
• Convert shell scripts into Python scripts
• Use Python to automate system tasks
• Process logs and complex data sets
• Build CLI tools for Unix system administration

Requirements

Prerequisites

  • Fundamental understanding of Unix/Linux operating systems
  • Comfort with command line usage (shell/Bash)
  • Experience creating basic shell scripts (e.g., loops, conditionals, file operations)
  • A general grasp of system administration concepts is advantageous
  • No prior Python knowledge is necessary

Target Audience

  • System administrators operating in Unix/Linux environments
  • DevOps engineers seeking to enhance their automation proficiency
  • Engineers and technical specialists relying on shell scripting for daily operations
  • IT professionals looking to shift from Bash to Python
  • Developers in Unix environments aiming to automate workflows more effectively

Number of participants


Price per participant

Testimonials (2)

Upcoming Courses

Related Categories