Custom Shell in C

  • Tech Stack: C ยท System Calls
  • Project URL: Github Link

Custom Shell Project

Description

Welcome to the Custom Shell project, Mini Project 1, where you will build your own shell. This shell implementation includes various features, system calls, and commands to provide a comprehensive user experience. Refer to Problem_statement.html for detailed requirements.

Features

Part A: Basic System Calls

Specification 1: Display Requirement

  • The shell prompt displays the current user, system name, and working directory.

Specification 2: Input Requirements

  • Supports ; or & separated lists of commands, handling random spaces and tabs.

Specification 3: warp

  • Changes the shell's directory and updates the prompt.
  • Supports flags: ~, .., ., and -.

Specification 4: peek

  • Lists files and directories with optional flags -a and -l.
  • Color-codes files, directories, and executables.

Specification 5: pastevents Commands

  • pastevents: Stores and outputs the 15 most recent commands, persisting across shell runs.
  • pastevents purge: Clears all stored past events.
  • pastevents execute <index>: Executes the command at the specified index in past events.

Specification 6: System Commands

  • Executes system commands in both foreground and background processes, providing process information upon completion.

Specification 7: proclore

  • Obtains information about a process, with an optional PID argument.

Specification 8: seek

  • Searches for files/directories in a specified target directory.
  • Supports flags: -d, -f, and -e.

Part B: Processes, Files, and Miscellaneous

Specification 9: I/O Redirection

  • Supports input/output redirection with >, >>, and <.

Specification 10: Pipes

  • Supports any number of pipes between commands.

Specification 11: Redirection along with Pipes

  • Handles I/O redirection in conjunction with pipes.

Specification 12: activities

  • Lists all running processes spawned by the shell with relevant information.

Specification 13: Signals

  • Implements ping command to send signals to processes, including Ctrl-C, Ctrl-D, and Ctrl-Z.

Specification 14: fg and bg

  • fg <pid>: Brings a background process to the foreground.
  • bg <pid>: Changes the state of a stopped background process to running.

Specification 15: Neonate

  • Prints the Process-ID of the most recently created process until the key 'x' is pressed.

Part C: Networking

Specification 16: iMan

  • Fetches man pages from http://man.he.net/ using sockets and outputs them to the terminal.

Usage

  • Clone the repository.
  • Compile the shell using the provided makefile or build instructions.
  • Run the shell executable to start using the custom shell.

For detailed usage of each command and further information, please refer to the Problem_statement.html and in-shell help commands.