Operating Systems and Networks Assignment 2 by Ishan Kavathekar (2022121003) for CS3.301
- Run the makefile using the make command.
- Run the ./shell command to run the shell.
- User can delete executable file using make clean command.
- User can exit the shell using exit command or CTRL+D
- The directory in which it is executed will be its home directory.
- The shell displays the username and hostname in the prompt.
- User can input any command from prompt
- cd command is used to directory to a specific directory. Various different variations of cd supported in the shell.
- cd: changes directory to the home direcotry.
- cd . :changes directory to current working directory.
- cd .. : changes directory to parent directory.
- cd - : changes directory to previous directory.
- cd ~ : changes directory to the home direcotry.
- echo command is used to output the string received by the user.
- echo : prints nothing
- echo {text} : prints the text after removing any extra tabs and spaces.
- pwd command returns the path of the current working directory.
- The ls command prints all the directories, files and executable files in the specified directory, file or executable.
- ls command takes two flags: -a and -l
- -a flag: This flag also outputs the hidden files and folders.
- -l flag: This flag outputs all the details of the files and folders in long format.
-The shell shoudl alsoexecute all commands like gedit, sleep and emacs.
- These commands can either executed in foreground or in the background.
- Any command ending with an '&' symbol is treated as a background command.
- Else it is considered as a foreground command.
- This command prints all the information about the given pid.
- The information printed is the pid, the status(running,sleep or zombie), memory and the executable path.
- This command prints if the background process exits normally or not.
- discover command is a user defined command which outputs all the directories and files in the specified directory or file.
- This command takes two flags: -d and -f.
- -d flag: Searches for all directories.
- -f flag: Searches for all files.
- history command outputs the last 10 commands given by the user.
- history command stores 20 commands but outputs only the latest 10 commands.
-
is used for output redirection
- < is used for input redirection
-
is used to append to the file
- It is assumed that the user will enter whitespace after every word.
- Pipes used to communicated between processes
- Lists all the jobs according to the flags.
- jobs -r : lists all the running jobs.
- jobs -s : lists all the stopped jobs.
- sig command takes two arguments: the process number and signal number.
- It executes the signal number on the given process.
- Brings background process corresponding to job number to the foreground.
- It throws an error if the given job number does not correspond to a valid job number.
- Changes state of stopped background job in running in the background.
- It throws an error if the given job number does not correspond to a valid job number.
- Pushes currrntly executing foreground job to background and changes it's state to stopped.
- Interrupts any ongoing foreground process by sending it the SIGINT signal.
- The commands will be of maximum length 200.