Course Outline
Day 1
Module 1: Introduction to Python for Unix Users
Topics
Why Python for scripting and automation
• advantages of Python for scripting
• using Python in system administration and DevOps
Bash vs Python comparison
• variables
• control flow (if, loops)
• working with files
• executing system commands
Structure of a Python script
• running Python scripts
• using the interpreter
• 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 – Python script with CLI arguments
Creating a Python script that:
• receives 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
- Basic knowledge of Unix/Linux operating systems
- Familiarity with command line usage (shell/Bash)
- Experience writing simple shell scripts (e.g. loops, conditions, file operations)
- General understanding of system administration concepts is beneficial
- No prior Python experience required
Target Audience
- System administrators working in Unix/Linux environments
- DevOps engineers looking to improve automation capabilities
- Engineers and technical specialists using shell scripting for daily tasks
- IT professionals interested in transitioning from Bash to Python
- Developers working in Unix environments who want to automate workflows more efficiently
Testimonials (2)
The adaptation of exos to our context and the consideration of our request
Amel Guetat - EURO-INFORMATION DEVELOPPEMENTS
Course - Fraud Detection with Python and TensorFlow
Machine Translated
Hands-on exercises related to content really helps to understand more about each topic. Also, style of start class with lecture and continue with hands-on exercise is good and helpful to relate with the lecture that presented earlier.