Skip to content

qwerty-arun/MiniShell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🐚 MiniShell - A Basic Linux Shell in C++

📜 About

  • MiniShell is a simple Linux shell written in C++.
  • It supports running basic commands, handling directory changes (cd), and keeps a simple command history.
  • This project was built to deepen my understanding of system calls (fork(), execvp(), wait()) and Linux internals.

🚀 Features

  • Run standard Linux commands : Supports external commands like ls, pwd, date, echo, etc. using execvp

  • Prompt Display : Colored Prompt using ANSI escape codes

  • cd command : to change directories using chdir()

  • Exit Command : exit terminates the shell loop

  • History Command : Keeps a maximum of 50 commands, trimming the oldest

  • Execute Commands from History : Supports !N to execute the N-th command in history

  • Basic error handling : Prints user-friendly messages when fork() or execvp() fail

  • Signal Handling : Gracefully handles Ctrl+C without exiting the shell

  • Command Piping : Support for | for chaining commands

  • Command Redirection : Support for > and `>>' for redirection

🔧 Technologies Used

  • C++

  • Linux System Programming (fork, execvp, wait, chdir)

  • GCC Compiler

  • Git for version control

🛠️ How to Build and Run

Clone the repository:

git clone https://github.com/qwerty-arun/MiniShell.git
cd MiniShell

Compile the project:

g++ main.cpp -o minishell

Run the shell:

./minishell

📸 Demo

Minishell written in C++!

📚 What I Learned

  • How Linux creates and manages processes.

  • How command execution actually works under the hood.

  • Handling user input and system calls properly.

  • Building real-world C++ projects.

🤔 Future Improvements

  • Add support for piping (|) and redirection (>, <)

  • Handle Command Chaining (&&, || and ;)

  • Implement tab-autocomplete for commands

  • alias command

  • Job Control: implement fg, bg and jobs commands

  • Support Environment Variables

  • Supporting background execution using '&'

🧑‍💻 Author

Arun K R

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages