Skip to content

A custom command-line shell for Windows built from scratch in C++, featuring a suite of built-in filesystem and text manipulation commands

Notifications You must be signed in to change notification settings

Cybiii/Powershell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Shell

A simple cross-platform shell implemented in C++.

Features

  • Executes external commands.
  • A suite of built-in commands for filesystem, text, and system information.
  • Customizable prompt that displays the current working directory.
  • Command history accessible via the history command.
  • Color-coded and formatted output for commands like ls and pwd.
  • A friendly welcome message on startup.

Built-in Commands

Filesystem

Command Description Usage
ls [path] Lists the contents of a directory in a detailed format. ls or ls src
pwd Prints the current working directory. pwd
cd [path] Changes the current working directory. cd src
mkdir [name] Creates a new directory. mkdir new_folder
rm [name] Removes a file or an empty directory. rm old_file.txt
touch [name] Creates an empty file or updates its timestamp. touch new_file.txt
cp [src] [dest] Copies a file. cp file.txt backup.txt
mv [src] [dest] Moves or renames a file. mv old_name.txt new_name.txt

Text Manipulation

Command Description Usage
cat [file] Displays the content of a text file. cat README.md
grep [pat] [file] Searches for a pattern in a text file. grep "CMake" README.md
head [file] Displays the first 10 lines of a text file. head README.md
head -n 15 [file] Displays the first 15 lines of a text file. head -n 15 README.md
tail [file] Displays the last 10 lines of a text file. tail README.md
tail -n 15 [file] Displays the last 15 lines of a text file. tail -n 15 README.md

System & Session

Command Description Usage
history Displays the command history for the current session. history
date Displays the current date and time. date
hostname Displays the computer name. hostname
echo [text] Prints text to the console. echo Hello, World!
exit Exits the shell. exit

Building the Project

This project uses CMake to generate build files.

Prerequisites

  • A C++17 compliant compiler (e.g., GCC, Clang, MSVC)
  • CMake (version 3.10 or later)

Build Steps

  1. Clone the repository (if you haven't already):

    git clone <repository-url>
    cd Powershell
  2. Create a build directory:

    mkdir build
    cd build
  3. Configure the project with CMake:

    cmake ..
  4. Build the project:

    • On Windows (with Visual Studio):
      cmake --build . --config Release
    • On Linux/macOS:
      make

The executable shell (or shell.exe on Windows) will be created in the build directory.

Running the Shell

Navigate to the build directory and run the executable:

./shell

Or on Windows:

.\\shell.exe

About

A custom command-line shell for Windows built from scratch in C++, featuring a suite of built-in filesystem and text manipulation commands

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published