A custom shell implemented in C with support for built-in commands, external command execution, pipes, redirection, background jobs, history, and process management utilities.
This shell replicates common Bash-like behavior and includes several custom built-in commands. It supports:
- prompt display with username and system hostname
- multiple commands separated by
; - background execution using
& - pipes with
| - input/output redirection using
>and>> - built-in commands for filesystem navigation, file display, process inspection, and command history
- external commands such as
cat,echo,sleep, and more
- Clear prompt with current user and hostname
- Handles multiple commands in one line
- Supports background processes and job control
- Supports pipes and output redirection
- History file saved in the user's home directory
- Custom commands for shell-specific utilities
Change the current working directory.
hop [directory]: Move to the specified directory.hop -: Switch back to the previous directory.hop ..: Move up one directory.hop ~: Change to the user's home directory.
Display a directory listing or file contents.
reveal [path]: Show the contents of the specified path.reveal -a [path]: Include hidden files in the listing.reveal -l [path]: Show detailed information, including permissions, owner, size, and modification date.reveal -la [path]orreveal -al [path]: Combined detailed listing and hidden files.
Example:
reveal -l -a /path/to/directoryManage shell command history.
log: Print stored command history.log purge: Clear command history.log execute [n]: Re-run the nth command from history.
Inspect process information.
proclore: Show information for the current shell process.proclore [pid]: Show information for the given process ID.
Search for files or directories by prefix.
seek [name]: Search for matching files and directories in the current directory tree.seek -f [name]: Search only files.seek -d [name]: Search only directories.seek -e [name]: When exactly one match is found, display the file or change into the directory.seek [flags] [name] [directory]: Search starting from the specified directory.
Example:
seek -d -e mydir .List processes spawned by this shell.
activities: Display managed background and stopped processes.
Fetch online manual pages for commands.
iMan [command_name]: Retrieve the manual page for the specified command.
Example:
iMan lsMonitor the most recently created process.
neonate -n <seconds>: Print the latest created PID every<seconds>seconds untilxis pressed.
Example:
neonate -n 5Control background and stopped processes.
fg <pid>: Bring the specified process to the foreground.bg <pid>: Resume the specified stopped process in the background.
Quit the shell.
exit: Exit the custom shell program.
Use the shell prompt to enter commands. Examples:
ls -l
hop ~/projects
reveal -la .
log
log execute 3
seek -f notes.txt .
proclore 1234
sleep 5 &
cat file.txt | grep hello > out.txt
fg 4321
bg 4321
neonate -n 2Multiple commands on a single line:
hop /tmp; ls -l; echo done$ ./a.out
[amisha@machine ~]$ hop /tmp
[amisha@machine /tmp]$ reveal -l
drwxr-xr-x 2 user group 4096 Jun 23 10:00 example/
-rw-r--r-- 1 user group 123 Jun 23 10:01 notes.txt
[amisha@machine /tmp]$ seek -f notes.txt .
./notes.txt
[amisha@machine /tmp]$ cat notes.txt | grep hello > out.txt
[amisha@machine /tmp]$ log
hop /tmp
reveal -l
seek -f notes.txt .
cat notes.txt | grep hello > out.txt
[amisha@machine /tmp]$ sleep 5 &
[amisha@machine /tmp]$ activities
sleep 12345 Running
[amisha@machine /tmp]$ fg 12345
[amisha@machine /tmp]$ exitBuild the project with the provided Makefile:
make
./a.outOr build and run in one step:
make runClean the executable:
make clean- External system commands are executed when the command is not recognized as a built-in.
logcommands are excluded from history to prevent recursive history entries.seek -eonly acts when exactly one match is found.- Background commands use
&and may be managed byfg/bg.