Get in Touch

Course Outline

Day 1
Module 1: Introduction to Python for Unix Users for Government

Topics
Why Python is preferred for scripting and automation in government settings
• advantages of Python for scripting tasks
• applications of Python in system administration and DevOps

Comparison between Bash and Python
• handling variables
• control flow (if statements, loops)
• file manipulation
• executing system commands

Structure of a Python script
• running Python scripts
• using the Python interpreter
• command line arguments
• introduction to argparse for argument parsing

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

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

Module 2: File and Directory Manipulation for Government

Topics
Managing the filesystem with Python
• reading from and writing to files
• navigating directories
• handling file paths

Utilizing the pathlib module
• path management
• performing file operations

Replacing Unix utilities with Python
• grep, find, sed, awk – Python equivalents

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

Exercise 2 – Processing configuration files
Creating a Python script that:
• reads text files
• extracts relevant data
• generates statistical reports

Day 2
Module 3: Log Processing and Text Manipulation for Government

Topics
Handling text with Python
• string operations
• filtering and transforming data

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

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

Exercises
Exercise 1 – Log file analysis script
Writing 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 for Government

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

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

Process management in Python
• monitoring processes
• simple parallel execution

Exercises
Exercise 1 – Script to run system commands
Developing a script that:
• executes Unix commands
• captures output
• generates reports

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

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

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

Python for DevOps automation in government environments
• collecting data from external services
• integrating with existing tools
• scripting infrastructure tasks

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

Exercise 2 – Automating data collection
Creating a Python script that:
• gathers system information
• generates reports in JSON or CSV format

Module 6: Building a CLI Tool for Administration for Government

Topics
Structuring a Python project for government use
• code organization
• function reuse
• modules and packages

Creating a command line interface (CLI) tool
• handling command line arguments
• generating structured output
• implementing error handling

Final Exercise
Participants will develop a CLI automation tool in Python that:
• analyzes log files
• identifies errors
• generates statistical reports
• can be executed from the command line

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

Requirements

Prerequisites

  • Basic understanding of Unix/Linux operating systems
  • Proficiency with command line operations (shell/Bash)
  • Experience in writing basic shell scripts, including loops, conditions, and file manipulations
  • A general knowledge of system administration principles is advantageous
  • No prior experience with Python is necessary

Target Audience

  • System administrators operating in Unix/Linux environments
  • DevOps engineers seeking to enhance their automation skills
  • Engineers and technical specialists who use shell scripting for routine tasks
  • IT professionals interested in transitioning from Bash to Python for more efficient task management
  • Developers working in Unix environments aiming to streamline their workflows through automation

This training is designed to align with the needs of government agencies and private sector organizations, providing a robust foundation for enhancing technical capabilities in system administration and automation.

 21 Hours

Number of participants


Price per participant

Testimonials (2)

Upcoming Courses

Related Categories