A custom shell implementation in C, supporting various built-in commands, process management, and I/O redirection.
-
hop: Changes the current working directory.
- Usage:
hop <path> - Supports flags:
.(current),..(parent),~(home),-(previous).
- Usage:
-
reveal: Lists files and directories.
- Usage:
reveal <flags> <path> - Flags:
-a(show hidden),-l(long format). - Color-coded output for files, directories, and executables.
- Usage:
-
log: Manages command history.
- Usage:
log(show history),log purge(clear history),log execute <index>(run command from history). - Stores up to 15 commands. Prevents duplicates.
- Usage:
-
activities: Lists all currently running processes spawned by the shell.
- Shows PID, Command Name, and State (Running/Stopped).
-
ping: Sends a signal to a specific process.
- Usage:
ping <pid> <signal_number>
- Usage:
-
fg: Brings a background process to the foreground.
- Usage:
fg <pid>
- Usage:
-
bg: Changes a stopped background process to running (in the background).
- Usage:
bg <pid>
- Usage:
- Command Execution: Executes standard system commands (e.g.,
ls,cat,sleep) usingexecvp. - Background Processes: Supports running commands in the background using
&. - I/O Redirection:
>: Output redirection (overwrite).>>: Output redirection (append).<: Input redirection.
- Piping: Supports piping between commands using
|. - Signal Handling:
Ctrl+C(SIGINT): Interrupts the foreground process.Ctrl+Z(SIGTSTP): Pushes the foreground process to the background (stopped).Ctrl+D: Logs out of the shell.
-
Navigate to the
shelldirectory:cd shell -
Compile the shell:
make
-
Run the shell:
./shell.out
src/: Source code files (.c).include/: Header files (.h).Makefile: Build configuration.
- Parser: Tokenizes input handling spaces, tabs, and special characters.
- Process Management: Tracks background processes and updates their status.
- History: Persists command history across sessions (stored in a log file).