Skip to content

Latest commit

History

15 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Python Linux Commands

A collection of Linux command-line utilities reimplemented in Python. The goal of this project is to understand how common Unix tools work by recreating their core functionality from scratch using Python.

Implemented Commands

CommandDescription
headDisplay the first lines or bytes of a file.
tailDisplay the last lines or bytes of a file.
wcCount lines, words, bytes, and characters in files.

More commands will be added over time.

Project Structure

.
├── exceptions/
├── head.py
├── tail.py
├── wc.py
└── README.md

Goals

  • Learn how classic Unix utilities are implemented.
  • Practice file I/O and stream processing.
  • Improve Python programming skills.

Usage

head

python head.py <file>

Display the first 10 lines (default):

python head.py example.txt

wc

python wc.py <file>

Examples:

python wc.py example.txt
python wc.py -l
python wc.py example.txt -c

Features

  • Command-line interface
  • Designed to closely match the behavior of the original Linux commands

Planned Commands

  • cat
  • sort
  • uniq
  • grep
  • cut
  • tr
  • tee
  • paste
  • nl
  • tac
  • basename
  • dirname

Why?

Reimplementing Unix tools is an excellent way to learn:

  • Text processing
  • File handling
  • Standard input/output
  • Command-line argument parsing

License

This project is licensed under the MIT License.

About

A Python-based simulator for common Linux command-line utilities and shell commands.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages