Skip to content

chakirben/0-shell

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

93 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

0-shell

A minimalist Unix-like shell implemented entirely in Rust, designed to run core Unix commands using low-level system operations rather than external binaries or existing shells.

Overview

0-shell is a lightweight, standalone shell designed for embedded Linux environments. All supported commands are implemented from scratch using Rust and system-level operations.

Features

Core Behavior

  • Displays $ prompt

  • Parses and executes commands synchronously

  • Exits gracefully on Ctrl+D (EOF)

  • Reports unknown commands with:

    Command '<name>' not found
    

Implemented Built-in Commands

Command Description
echo Print arguments
cd Change directory
ls List directory contents (-l, -a, -F)
pwd Print current directory
cat Output file contents
cp Copy files
rm Remove files/directories (-r)
mv Move or rename files
mkdir Create directories
exit Exit the shell

Example Usage

student$ ./0-shell
$ cd dev
$ pwd
/dev
$ ls -l
...
$ something
Command 'something' not found
$ echo "Hello There"
Hello There
$ exit
student$

Learning Objectives

  • File and directory system operations
  • Shell loop I/O handling
  • Robust syscall error handling
  • Unix process and system API fundamentals

Build

cargo build --release

Run

./target/release/0-shell

Structure

src/
  main.rs
  commands/
  utils/

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Rust 99.8%
  • Shell 0.2%