Listen to this Post
Python, one of the most popular programming languages today, has an intriguing origin story. It was born out of the need for a scripting language for Amoeba, a distributed microkernel operating system. The language had to be easy to write and read, extensible via C, and suitable for systems administration. Guido van Rossum, the creator of Python, wrote the first draft during the 1989 Christmas holiday. Python was intended as a spiritual successor to the ABC language but with more extensibility. After about a year of development, van Rossum posted it to USENET, and the language quickly gained traction. By 1994, Python made its official 1.0 release, and the rest is history.
You Should Know:
Python’s success can be attributed to its simplicity, readability, and extensibility. Here are some practical commands, codes, and steps related to Python that you should know:
1. Basic Python Commands
- Running a Python Script:
python3 script.py
- Installing Python Packages:
pip install package_name
- Creating a Virtual Environment:
python3 -m venv myenv source myenv/bin/activate # On Linux/Mac myenv\Scripts\activate # On Windows
2. Python Code Examples
- Hello World:
print("Hello, World!") - Using Lambda Functions:
square = lambda x: x 2 print(square(5)) # Output: 25
- List Comprehensions:
squares = [x 2 for x in range(10)] print(squares) # Output: [0, 1, 4, 9, 16, 25, 36, 49, 64, 81]
3. Advanced Python Features
- Working with
map(),filter(), andreduce():from functools import reduce</li> </ul> numbers = [1, 2, 3, 4, 5] doubled = list(map(lambda x: x * 2, numbers)) evens = list(filter(lambda x: x % 2 == 0, numbers)) sum_all = reduce(lambda x, y: x + y, numbers) print(doubled) # Output: [2, 4, 6, 8, 10] print(evens) # Output: [2, 4] print(sum_all) # Output: 15
4. Python for System Administration
- Running Shell Commands:
import subprocess subprocess.run(["ls", "-l"])
- File Handling:
with open("file.txt", "r") as file: content = file.read() print(content)
5. Python and Linux Integration
- Automating Tasks with Cron:
Add a Python script to cron for automation:
crontab -e
Add the following line to run a script every day at 6 AM:
0 6 * * * /usr/bin/python3 /path/to/script.py
What Undercode Say:
Python’s journey from a scripting language for a failed OS to one of the most widely used programming languages is a testament to its versatility and ease of use. Its principles of simplicity and extensibility have made it a favorite among developers, system administrators, and data scientists alike. Whether you’re automating tasks, analyzing data, or building web applications, Python’s extensive standard library and community support make it an invaluable tool.
Here are some additional Linux and Windows commands that complement Python’s capabilities:
- Linux Commands:
grep "pattern" file.txt # Search for a pattern in a file awk '{print $1}' file.txt # Print the first column of a file sed 's/old/new/g' file.txt # Replace text in a file -
Windows Commands:
dir # List directory contents type file.txt # Display the contents of a file tasklist # List running processes
Python’s integration with these commands allows for powerful scripting and automation, making it a must-learn language for anyone in the IT or cybersecurity field.
Expected Output:
- Python Official Documentation: https://docs.python.org/3/
- GitHub – Bython (Python with Braces): https://github.com/mathialo/bython
- Python Package Index (PyPI): https://pypi.org/
By mastering Python and its integration with system commands, you can significantly enhance your productivity and efficiency in both development and system administration tasks.
References:
Reported By: Laurie Kirk – Hackers Feeds
Extra Hub: Undercode MoN
Basic Verification: Pass ✅Join Our Cyber World:
- Running Shell Commands:



