amiria-shell
v1.0.7
Published
A custom Unix-like shell written in C
Downloads
646
Maintainers
Readme
Amiria Shell
⚠️ This is a CLI tool. Install globally.
🚀 Usage
Run instantly (no installation):
npx amiria-shellOr install globally:
npm install -g amiria-shellAmiria is a lightweight custom Unix-like shell built in C, designed to explore core systems programming concepts such as process creation, command parsing, memory management, and shell behavior.
It provides a simplified but powerful environment with support for built-in commands, command execution, and a custom alias system that enhances usability.
⸻
🚀 Features
• 🔹 Command parsing and execution (execvp) • 🔹 Built-in command support (cd, exit, etc.) • 🔹 Custom alias system (e.g., list → ls) • 🔹 Background process execution (&) • 🔹 Input/output redirection (>, <, >>) • 🔹 Pipe support (|) • 🔹 Signal handling (SIGINT, SIGCHLD) • 🔹 Memory-safe command lifecycle (manual allocation & cleanup)
⸻
🧠 How It Works
Amiria follows a clean execution pipeline:
Input → Tokenization → Alias Expansion → Built-in Check → Execution
- Tokenization – User input is parsed into command + arguments
- Alias Expansion – Custom commands are mapped to real shell commands
- Built-in Execution – Internal commands handled without spawning processes
- External Execution – Commands executed via fork() + execvp()
📦 Installation & Build
Requirements
• GCC • Unix-like system (Linux/macOS)
Build
gcc main.c shell.c helper_functions.c custom_commands.c -lreadline -o shell
Run
./shell
💡 Custom Commands (Aliases)
Amiria provides a set of user-friendly aliases for common terminal commands.
| Custom command | Equivalence | Description | |----------------|-------------|-----------------------------------| | home | cd ~ | Go to home directory | | back | cd .. | Move one directory up | | prev | cd - | Go to previous directory | | list | ls | List files | | listall | ls -a | List all files (including hidden) | | longlist | ls -l | Detailed file listing | | tree | ls -R | Recursive listing | | createfile | touch | Create a file | | createdir | mkdir | Create a directory | | remove | rm | Remove a file | | removefile | rm -f | Force remove file | | removedir | rm -r | Remove directory recursively | | copy | cp | Copy files | | move | mv | Move/rename files | | show | cat | Display file contents | | head | head | Show beginning of file | | tail | tail | Show end of file | | view | less | View file interactively | | clear | clear | Clear terminal | | where | pwd | Print working directory | | whoami | whoami | Show current user | | time | date | Display current date/time | | findfile | find | Search for files | | search | grep | Search text patterns |
⚙️ Built-in Commands
| Command | Description | |---------|--------------------------| | cd | Change directory | | exit | Exit the shell | | docs | Show all custom commands |
Example Usage
list
listall
home
createfile test.txt
show test.txt
Future Improvements
• User-defined aliases (alias command) • Persistent config file (.amirarc) • Command history • Tab completion • Improved error handling and logging
Author
Derrick Muturi
Machine Learning Engineer & Systems Developer Built as part of deepening understanding of low-level systems and shell design.
