- If the user give a command other than the 10 commands given in the assignment, the program will show command not found.
-1: prints every file/dir in a newline.
-a: prints directory comma seperated.
Errors: None
-n: this option is used to omit echoing trailing newline
-E: gives same output as echo without flags.
Errors: None
-r: remove directories and their contents recursively
-f: ignore nonexistent files and arguments, never prompt
Errors Shown:
- if no file/dir is given after rm it throws an error: missing operand.
-n: number all output lines
-E: display $ at end of each line
Errors Shown:
- If file does not exits it will throw an error: no such file or directory
--help: shows help for mkdir.
-v: print a message for each created directory
Errors Show:
- if no file/dir is given after rm it throws an error: missing operand.
- if the user does mkdir dir1/dir2 and dir1 doesn't exist it will show an error: directory does not exist.
- if the user does mkdir hello and hello exits it will again give the same error: File exists.
-u: print or set Coordinated Universal Time (UTC)
-R: output date and time in RFC 5322 format.
Example: Mon, 14 Aug 2006 02:34:56 -0600
Errors: None
--help: shows help for cd.
-P: use the physical directory structure without following
symbolic links: resolve symbolic links in DIR before
processing instances of `..'
Errors: None
--help: shows help for pwd.
-P: print the physical directory, without any symbolic links
Errors: None
-a: append that command in history.
-c: clears the history.
Erros: None
Error: None
1)Fork(): Used for creating a new process, known as child process and it concurrently runs with the parent process.
2)execvp(): the created child process does not have to run the same program as the parent process does. The execvp system call allow a
process to run any C file, whose executable file can be made.
3)chdir():It changes the current directory of the calling process to the directory specified in path.
4)readdir():This function returns a pointer to a dirent struct variable
pointing the next directory
5)opendir():This function opens a directory corresponding to the directory name given and returns a pointer of that directory
6)wait(): It blocks the calling process until one of the child processes exits. After child process
exits or ends, parent continues its execution after wait call instruction.
7)unlink(): unlink() deletes a file from the filesystem.
8)remove(): used to delete a file or directory.
9)mkdir(): creates a new directory of the name passed in it as argument.
10)getcwd(): used to get current working directory
11)exit(): exits out of the program.
>>exit