Skip to content

Latest commit

History

54 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

🐚 Simple C Shell v2.0

A lightweight Unix-like shell implementation in C, supporting built-in commands and execution of external programs. Perfect for learning shell fundamentals! 🧠


🚀 Features

🛠️ Built-in Commands

CommandEmojiDescription
echo📢Display arguments
cd📂Change directory
pwd🗺️Print working directory
type🔍Identify command type
exit🚪Quit shell
cat🐈Display file contents
clear🧹Clear terminal screen
sort🔢Sort file contents
head👆Show file head
grep🔎Pattern search
rm🗑️Remove files or directories
mv🔀Move or rename files
cp📄Copy files or directories
mkdir📁Create directories
helpShow help documentation
ps📊Show process status
df💽Show disk usage
top📈Show real-time system stats
  • 🌐 External Command Execution: Searches PATH for valid executables
  • 🛡️ Error Handling: Clear error messages for common issues
  • 💻 Interactive Interface: Familiar shell prompt experience

📦 Installation & Usage

Compile the Shell 🔧

gcc main.c -o shell

Run the Executable 🚀

./shell

Start Exploring 🔭

$ pwd
/home/user
$ help grep

📚 Examples

📂 File Operations

cat document.txt # 🐈 Display file
sort lines.txt # 🔢 Sort content
head -n 5 log.txt # 👆 Show first 5 lines
rm file.txt # 🗑️ Remove a file
rm -r folder # 🗑️ Remove a directory
mv file1 file2 # 🔀 Rename or move a file
cp source.txt dest.txt # 📄 Copy a file
mkdir new_folder # 📁 Create a new directory

🔍 Searching

grep -i "error" system.log # 🔎 Case-insensitive search
grep -nv "debug" app.log # 🔍 Inverted match with line numbers

🧭 Navigation

cd~/projects # 📂 Change directorypwd# 🗺️ Show current path

ℹ️ Information

type ls # 🔍 Shows executable pathhelpcd# ❓ Displays documentation

📊 System Monitoring

ps # 📊 Show current shell processes
ps -e # 📊 Show all processes
ps -u root # 📊 Show processes by user
ps aux # 📊 BSD-style output of all processes
df # 💽 Show filesystem usage
df -h # 💽 Human-readable sizes
df -T # 💽 Show filesystem types
top # 📈 Real-time CPU/memory usage
top -u username # 📈 Filter by user
top -n 1 # 📈 Run for 1 iteration

🤝 Contribution

Contributions welcome! 🎉 Please:

  1. 🐛 Open an issue to discuss changes
  2. 🌱 Fork the repository
  3. ✨ Create a feature branch
  4. 📝 Submit a PR with a detailed description

📜 License

MIT License © 2023 Mohamed Selim Mahjoub


Author

👨💻 Mohamed Selim Mahjoub

About

A lightweight Unix-like shell implementation in C v2.0

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages