This is a C-based Unix shell implementation developed throughout the Winter 2025 semester. This project involves building a fully functional shell called mysh that provides a comprehensive range of functionality matching that of other built-in shells. The shell supports built-in commands, environment variables, file system operations, process management, pipes, and network communication.
- Input validation : Command is limited to 128-characters.
- User interface : Interactive prompt ( $mysh )
- Signal Handling
- Error Management
- echo [text] : Display text to stdout
- exit : Terminate the shell
- ls [path] [--rec] [--d depth] [--f substring] : List directory contents with options
- cd [path] : Change directory (supports ., .., ..., ....)
- cat [file] : Display file contents or read from stdin
- wc [file] : Count words, characters, and lines
- ps : list processes launched by shell
- kill [pid] [signal] : send signals to processes
- Background processes (&)
- start-server [port] : Start a chat server on specified port
- close-server : Terminate the current server
- start-client [port] [hostname] : Connect to a chat server
- send [port] [hostname] [message] : Send message to server
- Pipes: Chain commands using "|" operator (Multiple pipes are supported)
mysh$ cat file.txt | grep hello | wc
- Dynamic environment variables: Initialize variables with $var expansion
- Memory Management: Dynamic allocation for variables and processes
- Any command not implemented as built-in is executed using the underlying Linux system binaries (via exec).
- For example,
mysh$ grep keyword file.txt
mysh$ sort data.txt
- Operating System : Linux
# clone repository
git clone https://github.com/junyalex/Linux-Shell.git
# Navigate to source directory
cd src
# Creates an executable file called "mysh".
make
# Run the shell
./mysh
The project uses the following compiler flags for strict debugging and memory safety.
-g -Wall -Wextra -Werror -fsanitize=address,leak,object-size,bounds-strict,undefined -fsanitize-address-use-after-scope