This is an implementation of a basic Linux Shell in C using Linux System Calls and inbuilt C libraries
git clone https://github.com/anoushkanarang/Linux-Shell.git
cd Linux-Shell
make
- shell.c stores the source code of the shell.
- getcat.c, getdate.c, getls.c, getmkdir.c and getrm.c contain source code for cat, date, ls, mkdir, rm (external) commands respectively.
- Description.txt contains description of each command executed in the shell.
- writehistory.txt stores the history of the shell.
- The remaining text files store the data to be displayed when the help flag of respective commands is called.
- Makefile is used for compilation.
- exit command is used to exit the shell where it is currently running.
-
history command is used to view the commands previously executed on the shell.
- --help: displays the help related information.
- -c: clears the history.
-
echo command is used to display line of text/string that are passed as an argument.
- -e: interprets \n as a new line character and prints everything after \n in a new line, doesn’t take inverted commas into account.
- -E: prints everything and doesn’t take inverted commas into account.
-
pwd command is used to print the current directory.
- --help: displays the help related information.
- -L: Softlink for the pwd command.
-
cd command is used to change current working directory.
- --help: displays the help related information.
- -L: Softlink for the cd command.
-
date command is used to display the system date and time.
- --help: displays the help related information.
- -u: displays date, time in UTC.
-
cat command reads data from the file and gives their content as output.
- --help: displays the help related information.
- -n: displays the contents of a file preceding with line numbers.
-
mkdir command is used to create directories.
- --help: displays the help related information.
- -v: It displays a message for every directory created (if the creation was successful or not)
-
ls command lists directory contents of files and directories.
- --help: displays the help related information.
- -1: used to list each directory in a new line.
-
rm command is used to remove files, directories, symbolic links from the file system.
- --help: displays the help related information.
- -i: makes the command ask the user for confirmation before removing each file, you have to press y for confirm deletion, any other key leaves the file un-deleted.
echo hello world
ls -1
date -u
mkdir five six seven
pwd --help
cat -n date.txt
date
history
cd five
pwd
rm five
exit