/Shell-in-C

This Project is Part of My University Project for Operating System Lab (OS Lab) Project. In This Project I Have Implemented a Basic Shell With the Help of C Language, Which Performs Many of The Functionalities as Similar to Linux Shell

Primary LanguageC

Shell


This Project is Part of My Operating System Lab (OS Lab)


Following Are The Key Points of Project

1) Shell

A Shell provides you with a CLI (Command Line Interface) interface. It gathers input from you and executes programs based on that input. When a program finishes executing, it displays that program's output. Shell is an environment in which we can run our commands, programs, and shell scripts. There are different flavors of a shell, just as there are different flavors of operating systems. Each flavor of shell has its own set of recognized commands and functions.

2) Working of Shell

Shell reads your input after you press Enter. It determines the command you want executed by looking at the first word of your input. A word is an unbroken set of characters. Spaces and tabs separate words.

3) Examples of Shell

There are many shells available in different operating systems. Few of them are given below

  • Linux Shell
  • Command Prompt
  • PowerShell
  • The Bourne Sell for Solaris

The Shell that we have implemented is basically a simples shell, which works very similer to the shell tha we use in th ubuntu operating system The Shell is named as Pearl

3.1) How to Run

In Order to Run This Project. Just Open Linux Terminal In Same Folder and Type

gcc Shell.c

and Press Enter and Type

./a.out

4) Basic Layout of Pearl

Basic Layout

The commands that we have implemented in this shell are given below

  • help
  • man
  • leave
  • pwd
  • whoami
  • echo
  • color
  • bgcolor
  • crdir
  • deldir
  • cd
  • ls
  • ls –all
  • ls –tree
  • del
  • cat
  • touch
  • copy

5) Cat Command

cat commands is implemented. The working of this command is to read the content of file and also write the content into the file.

Cat Command

    //Read Format
    cat FILENAME.txt
    //Write Format
    cat > FILENAME.txtCat Read

6) CD Commands

CD Commands is Refferred as Change Directory Command , this is use to move from one directory to another directory. We can move to the parent directory by command of cd ..

CD Command

// Syntax:
 cd New
 cd ..
 cd .
 cd Folder#1

7) CRDIR & DELDIR

These both command are used to create the directory and delete directory. Borth commands are multi-arguments. We can give one or more than one argument to this commands. This is helpful in creating and deleting multiple direcroties at a time

Basic Layout Basic Layout

// Syntax:
crdir Folder#1
crdir Folder#2
deldir Folder#1
deldir Folder#2

8) LS Command

LS commad is used to list all files and folder names in the current directory. This is implemented in three ways

ls
// This is very simple , this only show the folder of files in the current directory

lstree

// This command is used to show the all files and folder inside a current folder . this works recursively and check every fil and folder

lsall

// This command is very similer to the simple ls commands , but provides us with the additional information including the files or folder access rights , size and creation date etc

LS Commands LS Commands LS Commands

9) Man Command

Man keyword is short form manual , this command is used to get the deep information about command.

Basic Layout

// Syntax:
man wipe
//give manual of wipe command used to clear the screen
man color
//give manual color command
man copy
//give manual of copy commandHelp Command:

10) Help Command

Help command is used to know that which command are supported by this shell and and detailed preview of the command syntax, which is helpful for new user. Just type help in terminal to run this commmand.

Basic Layout