Shell with some basic functionalities written in C with the help of system header files.
- Clone the directory
- run
makeinside the directory. ./zto run the shell.exitto exit out of the shell.
Regardless of where you write the command by adding spaces or tabs, it will behave in the same way.
You can run more than 1 shell command in a single line by separating them with a ;
- Lists the contents of the given directory.
- Add
-lto display the details of each file. - Add
-ato display the hidden contents. - The directories and flags can be mentioned in any order after ls
- change the current working directory to the relative or the absolute path passed as argument.
~to go back to the shell executable directory...to go to the previous directory.-will change your directory to the previous directory you were in.
- To see the present working directory
pwd.
- Displays the process information.
- Process ID
- Process Status
- Virtual memory
- executable path.
- If the PID is not mentioned it will show the information about the shell process.
- Displays the last used commands with most recent ones appearing at the bottom of the list.
- stores uptill 20 history commands.
- gives the output of 2 particular commands continuously till interrupted.
nightswatch -n [time] {interrupt/newborn}- interrupt:
- Shows the number of keyboard interrupts handled by each CPU
- newborn:
- Shows the last run process on the system.
<is used for input redirection.cat < inputFile contents of input are redirected to stdin and cat is executed.>is used for output redirection.ls > outputthe output of ls is redirected to output file.- Both of them can be combined together in a single command.
|Can be used to redirect one commands output to another file.ls | wcWill redirect the output of ls to wc.- More than 2 commands can be chained together for piping.
setenvcan be used to overwrite the value of a environment variable to the given value.unsetenvcan be used to remove the variable from the environment.getenvcan be used to print the value of the given environment variable.
- Jobs are processes spawned by the shell,
jobswill list the processes spawned by the shell along with their status and the pid. kjob job_number signal_numberWill send the signal to the given job.overkillWill kill all background processes at once.exitWill exit out of the shell.
ctrl+zwill kill send the current foreground process to the background and will stop the process.ctrl+cwill interrupt the currently running foreground process, if no foreground process is present, it will do nothing.
fgcan be used to bring a background process to the foreground process. The shell will only continue to execute after the process has terminated.bgcan be used to make a stopped background process run again.