Skip to content
This repository was archived by the owner on May 24, 2025. It is now read-only.

Latest commit

 

History

119 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Operating System Shell

A basic shell that targets both Windows And Ubuntu written in C++ for COSC 439 - Operating Systems course.

Features

This shell implements the following commands:

  • cd: Change directory
  • clear: Clear the terminal
  • environ: Display environment variables
  • echo: Display a line of text
  • help: Display help information
  • pause: Pause the shell
  • quit: Quit the shell
  • ls: List directory contents
  • pwd: Print working directory
  • cat: Display file contents
  • mkdir: Create directories
  • rmdir: Remove empty directories
  • rm: Remove files
  • cp: Copy files
  • mv: Move/rename files
  • touch: Create empty files or update timestamps
  • wc: Word count (lines, words, characters)
  • grep: Search text patterns in files

Building the Project

The project is built using C++. To build the shell:

  1. Ensure you have a C++ compiler installed like g++
  2. Navigate to the project directory
  3. Compile the main file:
g++ 439shell.cpp -o 439shell

Usage

Interactive Mode

Run the compiled shell:

./439shell

The shell will start with a prompt where you can enter commands.

>> [command] [arguments...]

Command Line Mode

You can also run individual commands directly from the command line without actually starting the shell.

./439shell [command] [arguments...]

Example:

./439shell help
./439shell ls
./439shell mkdir new_directory
./439shell cat file.txt

Command Reference

Directory Operations

  • mkdir <directory>: Create a new directory
  • rmdir <directory>: Remove an empty directory
  • ls: List directory contents
  • pwd: Print current working directory

File Operations

  • touch <file>: Create an empty file or update timestamp
  • rm <file>: Remove a file
  • cp <source> <destination>: Copy files
  • mv <source> <destination>: Move or rename files

File Content Operations

  • cat <file>: Display file contents
  • wc <file>: Count lines, words, and characters
  • grep <pattern> <file>: Search for text patterns

Project Structure

  • src/: Contains implementation files for each command
  • src/Windows/: Windows-specific command implementations
  • src/Unix/: Unix-specific command implementations
  • src/Models/: Shell model classes. Also holds functions that should work no matter the platform
  • 439shell.cpp: Main shell implementation

System Requirements

  • C++11 or later
  • Unix-like system (Linux, macOS, or WSL)
  • Windows
  • Standard C++ libraries

About

A basic operating system shell capable of executing commands and performing fundamental system operations effectively. Each command is directly integrated into the shell program. All functionalities are seamlessly integrated and executed within the shell itself.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Used by

Contributors

Languages