Skip to content

Mini shell made in C for Linux using GNU Readline Library

License

Notifications You must be signed in to change notification settings

amoghmc/mini_shell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

96 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mini Linux Shell

Mini shell made in C for Linux using GNU Readline Library

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Contributing
  5. License
  6. Acknowledgments

About The Project

  • Inspired by Cornell's CS 414's Shell assignment, this project aims to create a shell in C, much like Csh or Bash
  • Implements various advanced programming techniques such as process creation and control, file descriptors, signals, I/O redirection and pipelines
  • Takes in a list of commands separated by space or pipes and parses it into individual components such as commands, flags, I/O files, pipe and I/O operators
  • Shell prompt displays the user's present working directory, user login info and their host machine name
  • Final results can be neatly saved in a CSV format.
  • Features 5 built-in commands: cd, history, jobs, kill and exit
  • Caches user commands using GNU Readline/History library
  • Allows users to create background jobs by using the '&' operator and display them with their process IDs using the 'jobs' command
  • Background jobs can be killed using 'kill' command followed by the process ID of the job
  • Dynamic analysis tools such as Valgrind was used to detect and subsequently fix memory leaks

(back to top)

Built With

  • C

(back to top)

Getting Started

Prerequisites

  • GNU Readline Library

You can install the GNU Readline library GNU Readline library using the following command

sudo apt-get install libreadline6 libreadline6-dev 

Installation

  1. Automatically compile the project using make,
    make
  2. Then run using the shell by using the following command,
    ./shell 

Using built-in commands

  • Go to the specified directory:

    cd [path/to/directory]
    
  • View jobs spawned by the current shell:

    jobs 
    
  • Display the commands history list:

    history 
    
  • Kill a background job:

    kill [process_id] 
    
  • Exit the shell:

    exit 
    

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the MIT License. See LICENSE.md for more information.

(back to top)

Acknowledgments

(back to top)