Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🐚 NovaShell — High-Performance Custom Unix Shell

Language C OS Build Makefile Status

NovaShell is a feature-rich, high-performance Unix-like command shell implemented in C. Demonstrating low-level operating system fundamentals including process management (`fork`, `execvp`), inter-process communication (pipes), IO redirection, safety guards, and real-time CPU/memory resource monitoring.


🌟 Key Features

  • Process Lifecycle Management: Fast process spawning with fork(), execvp(), and non-blocking background job handling (&).
  • 📁 Builtin Shell Navigation: Full cd support (including ~ home expansion and cd - directory toggle), pwd, and help.
  • 🔀 Inter-Process Communication: Pipeline execution (cmd1 | cmd2) connecting stdout to stdin via Unix pipes.
  • 📤📥 File IO Redirection: Supports stdout truncation (>), stdout append (>>), and stdin input redirection (<).
  • 🛡️ Safety Lockdown Layer: Intercepts and blocks destructive root commands (rm -rf, shutdown, reboot).
  • 💡 Typo Suggestion Engine: Intelligent command recommendation for mistyped utility names.
  • 📊 Real-Time Resource Monitoring: Live visual CPU/memory usage bars, wall-clock timing, and performance badges (FAST, NORMAL, SLOW).
  • 📜 Session History & Analytics: Builtin command history tracking and exit session performance summary.

🏗️ Architecture & Component Overview

  NovaShell Core Architecture
  ├── src/main.c      - Command loop, builtin dispatcher, env expansion, IO redirection
  ├── src/pipe.c      - Inter-process pipe handler (`dup2`, `pipe`)
  ├── src/monitor.c   - Real-time CPU & memory consumption tracker (`getrusage`, `gettimeofday`)
  ├── src/safety.c    - Danger interception layer (`rm -rf` guard)
  ├── src/history.c   - Circular command history buffer
  ├── src/suggest.c   - Levenshtein-based command suggestion engine
  └── src/summary.c   - Session statistics & command counters

🛠️ Build & Installation Guide

Prerequisites

  • GCC / Clang compiler supporting C99 standard
  • GNU Make

Compilation

# Clone or navigate to directory
cd nova-shell

# Compile project using Makefile
make

# Execute NovaShell
./build/nova-shell

Clean Build Artifacts

make clean

💻 Interactive Commands & Usage Syntax

Feature Example Command Description
Directory Navigation cd ~/Projects Change directory (cd - to return to previous path).
Print Directory pwd Print current working directory.
Pipeline Execution ls -la | grep txt Pipe output from command 1 into command 2.
Output Redirection echo "Hello" > out.txt Truncate and write to file.
Append Redirection echo "Line 2" >> out.txt Append text to file.
Input Redirection cat < out.txt Read stdin from input file.
Background Execution sleep 10 & Execute task asynchronously in background.
Command History history List recent command execution history.
Help Manual help Display builtin command manual.
Exit Shell exit Output session telemetry summary and terminate shell.

🧪 Testing Verification

# Test 1: Navigation & Env Expansion
nova-shell [~/Projects/nova-shell]> cd ~
nova-shell [~]> pwd
/Users/username

# Test 2: Pipe & Redirection
nova-shell [~/Projects/nova-shell]> echo "NovaShell Enterprise" > test.txt
nova-shell [~/Projects/nova-shell]> cat test.txt | grep Nova
NovaShell Enterprise

# Test 3: Safety Layer
nova-shell [~/Projects/nova-shell]> rm -rf /
⚠️ Safety Alert: Dangerous command blocked for system security.

👨‍💻 Developer & Attribution

Developed by Om Srivastava (@IronLad123)
B.Tech in Computer Science & Engineering (Specialization in Data Science)

About

Custom Unix shell with safety and visual resource monitoring

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages