# mohamedibrahem001/linux_exercise architecture

> Architecture diagram of the GitHub repository mohamedibrahem001/linux_exercise, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mohamedibrahem001/linux_exercise
- Repository: https://github.com/mohamedibrahem001/linux_exercise

## Overview

##### Project type and purpose
- This is a small collection of Embedded Linux command‐line exercises (cp_dev, echo_dev, mv_dev, pwd_dev), each written in C to replicate basic shell utilities.
- It’s effectively an open-source toolset of standalone CLI programs for learning Linux system calls and file-system interactions.

##### File structure
- Top level contains only standalone C source files (`cp_dev.c`, `echo_dev.c`, `mv_dev.c`, `pwd_dev.c`), plus `README.md` and `LICENSE.txt`.
- No multi-tier framework directories—each `.c` file is its own self-contained component.
- No build scripts or configs other than the generic `gcc` invocation in the README.

##### README for additional insights
- Confirms compilation with `gcc src_file.c -o output_file`.
- Shows example usage/output for `pwd`.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User and Shell Layer
    User["User / Developer"]:::userShell
    Shell["Shell / Terminal"]:::userShell

    %% CLI Utilities Layer
    subgraph "CLI Utilities" 
        direction TB
        cp_dev["cp_dev\n(open, read, write)"]:::cli
        echo_dev["echo_dev\n(write)"]:::cli
        mv_dev["mv_dev\n(rename)"]:::cli
        pwd_dev["pwd_dev\n(getcwd)"]:::cli
        NewCmd["New Command"]:::cli
    end

    %% Library Layer
    libc["C Standard Library (libc)"]:::lib

    %% Kernel Layer
    Kernel["Linux Kernel\n(system-call interface)"]:::kernel

    %% File System Layer
    FS["File System / Storage Hardware"]:::fs

    %% Documentation Layer
    subgraph "Project Docs"
        direction TB
        README["README.md"]:::docs
        LICENSE["LICENSE.txt"]:::docs
    end

    %% Data Flow
    User -->|"issues command"| Shell
    Shell -->|"fork & exec"| cp_dev
    Shell -->|"fork & exec"| echo_dev
    Shell -->|"fork & exec"| mv_dev
    Shell -->|"fork & exec"| pwd_dev
    Shell -->|"fork & exec"| NewCmd

    cp_dev -->|"calls libc"| libc
    echo_dev -->|"calls libc"| libc
    mv_dev -->|"calls libc"| libc
    pwd_dev -->|"calls libc"| libc
    NewCmd -->|"calls libc"| libc

    libc -->|"system calls"| Kernel
    Kernel -->|"performs ops"| FS
    FS -->|"results"| Kernel
    Kernel -->|"returns results"| libc
    libc -->|"returns results"| cp_dev
    libc -->|"returns results"| echo_dev
    libc -->|"returns results"| mv_dev
    libc -->|"returns results"| pwd_dev
    libc -->|"returns results"| NewCmd
    cp_dev -->|"exit status"| Shell
    echo_dev -->|"exit status"| Shell
    mv_dev -->|"exit status"| Shell
    pwd_dev -->|"exit status"| Shell
    NewCmd -->|"exit status"| Shell
    Shell -->|"output / status"| User

    %% Click Events
    click cp_dev "https://github.com/mohamedibrahem001/linux_exercise/blob/main/cp_dev.c"
    click echo_dev "https://github.com/mohamedibrahem001/linux_exercise/blob/main/echo_dev.c"
    click mv_dev "https://github.com/mohamedibrahem001/linux_exercise/blob/main/mv_dev.c"
    click pwd_dev "https://github.com/mohamedibrahem001/linux_exercise/blob/main/pwd_dev.c"
    click README "https://github.com/mohamedibrahem001/linux_exercise/blob/main/README.md"
    click LICENSE "https://github.com/mohamedibrahem001/linux_exercise/blob/main/LICENSE.txt"

    %% Styles
    classDef userShell fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef cli fill:#90EE90,stroke:#333,stroke-width:1px
    classDef lib fill:#FFFFE0,stroke:#333,stroke-width:1px
    classDef kernel fill:#F08080,stroke:#333,stroke-width:1px
    classDef fs fill:#D3D3D3,stroke:#333,stroke-width:1px
    classDef docs fill:#E0E0E0,stroke:#333,stroke-width:1px
```
