A custom made user-defined interactive shell program with implementations of some built in commands and the capability to start any user defined executable. Created as part of CS3.301 - Operating Systems and Networks at IIIT-H.
Problem statements present in the two .pdf
files.
- Clone this directory and
cd
into it. - Run the command
make
. - Run
./srujshell
to get a prompt of the form username@system_name:curr_dir - Run any command in the shell. It can entail as many number of tabs and spaces, the shell accounts for those.
- In order to exit, you can run either exit or quit.
-
pwd
- Displays the name of current working directory.
-
cd [directory]
- Changes current working directory to the directory specified.
-
echo [argument]
- Displays whatever is specified in [argument]
-
ls
- Lists all the files and directories in the specified directory.
- Variations such as
ls, ls . , ls etc
also work. - Also handles multiple directories as arguments. eg.
ls -l dir1 dir2 dir3
- Also highlights directories in blue and executable files in green.
-
pinfo [pid]
- Displays process info such as status, memory and executable path about given pid. If no pid is mentioned, displays information of the shell.
-
discover <target_dir> <type_flags> <file_name>
- Searches for files in a directory hierarchy.
-
jobs
- Prints a list of all currently running jobs along with their PID in order of their creation and also their status.
- Gives the state of the job – Running, Sleeping, Stopped or Defunct.
-
sig <jobnumber> <signalnumber>
- Takes the job number (assigned by your shell) of a running job and sends the signal corresponding to the signal number to that process.
-
fg <jobNumber>
- Brings the running or stopped background job corresponding to job number to the foreground, and changes its state to running.
-
bg <jobNumber>
- Changes the state of a stopped background job to running (in the background).
-
history
- Prints the last 10 commands if no argument specified.
- Shell supports '&' operator which lets a program run in background.
- All other commands are treated as system commands like emacs, vim etc.
- Upon termination of a background process, the shell prints its PID and exit status.
-
CTRL-Z
- Pushes any currently running foreground job into the background, and change its state from ‘running’ to ‘stopped.
-
CTRL-C
- Interrupts any currently running foreground job, by sending it the SIGINT signal.
-
CTRL-D
- Logs you out of the shell.
-
Autocompletion
- Autocompletes the file name on pressing the tab key.