Set Up Your Lab
/step-by-step skill.You learn Python for system administration by running things: reading /etc/passwd, starting processes, checking ports. So before the first chapter, get a Linux box with Python on it.
You have two options. Pick one.
Option 1: A free Linux VM in your browser (recommended)#
The iximiuz Labs Python Playground gives you a real Linux VM with root access, the latest Python 3, uv, pyenv, Docker and VS Code. It starts in seconds and there is no paywall. You only need to sign in.
- Open the Python Playground.
- Sign in and click Start playground.
- Open the terminal tab and check your Python version:
python3 --version- Clone this guide so every example is on the machine:
git clone https://github.com/tuladhar/Python-for-SysAdmin.git
cd Python-for-SysAdmin/examples
lsBecause it is a throwaway VM, you can break things safely. Delete files, kill processes, fill the disk. Nothing touches your own laptop.
Option 2: Your own Linux or macOS machine#
Most Linux distributions and macOS already ship Python 3. Check it:
python3 --versionYou want Python 3.11 or newer. Every example in this guide uses only the standard library, so there is nothing to install with pip.
If you need a newer Python, uv is the quickest way to get one without touching the system Python:
curl -LsSf https://astral.sh/uv/install.sh | sh
uv python install 3.13
uv run --python 3.13 python --versionNever upgrade or remove the system Python on a server. Tools like
dnf,aptand many agents depend on it. Useuvor a virtual environment instead.
How to use this guide#
- Each chapter introduces one module and ends with a small, real script.
- Type the examples yourself instead of copy-pasting. You remember what your fingers typed.
- Every script lives in the
examples/folder, so you can compare your version with the reference. - Try the exercises at the end of a chapter before you move on.
Stuck? Learn it step by step with AI#
If a concept doesn't click, use the free /step-by-step Claude skill. It explains any topic one short sentence at a time and waits for you to say "understood" before moving on, so you never get a wall of text:
/step-by-step how subprocess.run captures stdout and the exit code
/step-by-step what os.walk yields for each directory