Python for Unix and Linux System Administration
Python for Unix and Linux System Administration
Summary:
Introduction
The book «Python for Unix and Linux System Administration» (2008, 456 pages) by Noah Gift and Jeremy Jones is a practical guide that bridges the gap between the world of system administration and the Python language. In an era when automation has become critical for managing server infrastructure, this book offers system administrators a powerful tool for writing scripts, managing processes, processing text, and interacting with the operating system. Despite the age of the publication, many concepts and techniques remain relevant, especially for those working with classic Unix-like systems.
What this book is about
The book is not a Python tutorial for beginners — it assumes basic familiarity with the language. Instead, the authors focus on practical tasks that a system administrator faces daily: log monitoring, process management, working with the file system, network interaction, and automating configuration deployment. Each chapter is built around real-world scenarios and contains ready-to-use code examples that can be adapted to your own needs.
Who this book is for
The primary audience is Linux/Unix system administrators who want to move from writing Bash scripts to the more powerful and expressive Python. The book will also be useful for developers who have to deal with infrastructure administration, and for anyone who wants to deepen their understanding of Python's interaction with the operating system.
What the reader will learn
- Process and thread management: starting, monitoring, terminating processes, working with subprocesses via the
subprocessandosmodules. - Working with the file system: recursive directory traversal, searching for files by patterns, managing access permissions.
- Text and log processing: using regular expressions, parsing configuration files, log aggregation.
- Network programming: creating TCP/UDP clients and servers, working with sockets, HTTP requests.
- Configuration automation: writing scripts for managing configuration files, templating.
- Monitoring and notifications: collecting metrics, sending email notifications, integrating with SNMP.
- Working with databases: connecting to SQLite, PostgreSQL, MySQL from Python.
- Creating command-line utilities: using the
optparsemodule (andargparsein newer versions) to create CLI tools.
Strengths
One of the main advantages of the book is its practical focus. Every example can be immediately run and tested. The authors do not delve into abstract theories but show how to solve a specific problem — for example, writing a script for backup or disk space monitoring. The code is well-commented, which makes it easier to understand. It is also worth noting that the book covers both classic Unix tools (grep, sed, awk) and their Python counterparts, which helps administrators smoothly transition to the new language.
Special mention deserves the chapter dedicated to parallel task execution and using the threading module — this is rare for books on administration. Additionally, the authors pay attention to security issues: proper password handling, restricting script privileges, and protection against injections.
Who is recommended
The book will be useful for:
- Linux/Unix system administrators looking to automate routine tasks.
- DevOps engineers who want to deepen their Python knowledge for writing orchestration tools.
- Developers transitioning to the infrastructure side.
- Students studying system programming.
However, it should be noted that the book was published in 2008, and some modul
Recommendations
Kotlin and Databases: A Practical Guide
TypeScript and Microservices: A Practical Guide
Functional Programming in PHP. Writing Clean, Predictable, and Testable Code
Testing C# (.NET) Applications. The Complete Guide
Go (Golang) Application Architecture: From Idea to Production
Cython: A Guide for Python Programmers