Python for system administrators

Instructor: Vern Ceder

Part one (the morning) of this tutorial will be a hands-on exploration of Python on Linux. It will assume some prior programming experience, but not necessarily Python. We'll survey Python's growing importance in common Linux distro's, and introduce/review the basics of the language. We'll also cover how to create clean, maintainable and "Pythonic" code. From there we'll cover how to handle command line options and redirect standard I/O, and begin to look at how to call non-Python utilities.

  • Introduction
  • Typical sysadmin scripting tasks
  • Pros and cons of Python for system admin 
  • Python - intro/review of the language
  • Creating a Python script for Linux
  • structuring Python code correctly - stand-alone scripts and libraries
  • handling command line options
  • handling stdin, stdout and stderr - piping and redirection
  • calling non-Python utilities

Part two (the afternoon) will concentrate on learning how to use Python to traverse file systems, use regular expressions and test Python scripts. As time allows fetching and serving files, connecting to other systems via SSH and processing email will be covered. Python 3 will be introduced along with discussion of whether you should learn/support/migrate to Python 3. A list of further resources will also be provided. 

  • Putting Python to work in Linux
  • calling non-Python utilities, part 2
  • traversing file systems
  • regular expressions
  • "daemonizing" a Python script
  • testing scripting across the network
  • fetching and serving files
  • connecting to other systems (SSH)
  • sending and processing email 
  • Wrap up
    • What about Python 3?
    • Where to find out more 
Note: Students are strongly encouraged to have a laptop running Linux (or a VM) with Python 2.5, 2.6 or 2.7 installed.

Instructor Bio: Vern Ceder is Lead Developer for Zoro Tools, Inc in the Chicago area and former Director of Technology at Canterbury School, in Ft Wayne, IN, and an organizer of the Fort Wayne LUG. He has been using Python in a variety of applications since 2001, and has given presentations on Python, Linux and related topics at various national and regional conferences, including the National Educational Computing Conference (NECC) in Washington, DC and Ohio LinuxFest. Vern is also the author of The Quick Python Book, 2nd ed., from Manning Publications