Username using 'getlogin'
Hostname using 'gethostname'
Current directory using 'getcwd'
cd: using 'chdir'
pwd: using 'getcwd'
echo: using 'printf'
used 'strtok' to get arguments
used 'opendir' to open a directory using 'while' loop
used 'stat' command to get file info
used 'printf' to display details
used 'fork' to start a new process
fg: parent waits for child to execute using 'wait' command
bg: parent does not wait
used 'execvp' to execute system commands
if no pid is given replace 'pid' with 'self'
read file '/proc/pid/stat' for pid, status and virtual
memory used.
read the link to file '/proc/pid/exe' to get executable.
maintained an array of all bg started processes.
after executing all commands everytime checking if the
process exists or not by opening '/proc/pid' directory.
printing the exited processes using 'printf'
dirty:
used 'execvp' to implement 'watch' command
opened '/proc/meminfo' to read the dirty memory.
interrupt:
used 'execvp' to implement 'watch' command
opened '/proc/interrupts' to read the CPU usage by
the keyboard interrupt.