Conceptual Examples
8/26/26About 2 minAbout 244 words
Conceptual Examples
Since this is the introduction, we will not yet write complex logic (code). Instead, let’s look at the conceptual difference between how a SysAdmin handles a task manually versus how they would approach it with Python.
Example 1: The “User Audit” Task
The Manual Way:
- SSH into Server A.
- Run cat
/etc/passwd. - Copy the output to a text file.
- SSH into Server B.
- Run cat
/etc/passwd. - Copy the output to the same text file.
- Repeat for 20 servers.
- Manually search for unauthorized users.
The Python Way (Conceptual): A Python script is written that:
- Reads a list of IP addresses from a file.
- Uses a library (like Paramiko) to SSH into each server automatically.
- Runs the command
cat /etc/passwd. - Saves the results into a single, organized CSV file.
- Alerts the admin if a specific unauthorized username is found.
Example 2: The “Network Connectivity” Check
The Manual Way:
- Open a terminal and ping five critical gateways one by one:
ping 192.168.1.1→ Success.ping 192.168.1.2→ Success.ping 192.168.1.3→ Fail!
The Python Way (Conceptual): A Python script is written that:
- Contains a list of 100 critical IP addresses.
- Loops through the list and pings each one.
- If a ping fails, it immediately sends an email or a Slack notification to the admin.
- Logs the downtime in a file for the monthly uptime report.